This content has been marked as final.
Show 3 replies
-
1. Re: how to terminate @Asynchronous method
gbc1 Sep 19, 2007 7:03 AM (in response to tjakopec)Do you use Quartz or EJB Timers?
Doc Reference (CR1): http://docs.jboss.com/seam/2.0.0.CR1/reference/en/html/jms.html#d0e11316[/url] -
2. Re: how to terminate @Asynchronous method
tjakopec Sep 19, 2007 7:40 AM (in response to tjakopec)I don't use quartz, but I didn't also use classic EJB timers (I read http://docs.jboss.com/seam/2.0.0.CR1/reference/en/html/jms.html#d0e11316)
I just annotated method with @Asynchronous ant its working for me
@Asynchronous = import org.jboss.seam.annotations.async.Asynchronous;
Help with approach is appreciated! -
3. Re: how to terminate @Asynchronous method
gbc1 Sep 19, 2007 4:30 PM (in response to tjakopec)Look deeper into 18.1.1:
The Timer object shown below is the EJB3 timer when you use the EJB3 dispatcher. For the default ScheduledThreadPoolExecutor, the returned object is Future from the JDK. For the Quartz dispatcher, it returns QuartzTriggerHandle, which we will discuss in the next section.
So you just need to declare your Method on the Interface to return this special object and implement it that way:
a) A Future object (with default scheduler, java.util.concurent i think):public Future odradi(@Expiration Date date, @IntervalCron Long interval,@FinalExpiration Date kraj) { return whatever; // will be ignored }
b) acoording to this a Timer object for EJB3 (javax.ejb i think)Timers or
c) a QuartzTriggerHandle object
You will receive this object immidiatly and may sace it into Context, a map in an Application scoped manager or whereever. With this Object you are able to stop the timed call (I'm working with quartz and it just works)
Hope this is what helps you out,
Greetz GHad