users@glassfish.java.net

Re: Best way to kick off thread from EJB singleton bean?

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 18 Jun 2010 14:13:37 -0700

How long do you need the daemon thread for? I'd say that Async is the
closest match in the EJB land.

Best,
-marina

glassfish_at_javadesktop.org wrote:
> I have a singleton session bean.
>
> In it, I need to ask the container to--in a spec-compliant way--kick off what amounts to a daemon thread.
>
> I know that I have several options ranging from creating a single-use Timer to somehow invoking an asynchronous method on the same bean (where the return type is essentially Future<void>, however one would write that.
>
> I'm leaning towards the Timer.
>
> I have experience writing resource adapters, and there there is a very convenient item called a WorkManager. You get a handle to it and give it a Work instance, and it runs it for you in the background, taking care of cleanup at shutdown. I'm looking for the equivalent from the EJB 3.1 side.
>
> Thanks,
> Laird
> [Message sent by forum member 'ljnelson']
>
> http://forums.java.net/jive/thread.jspa?messageID=474866
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>