users@jersey.java.net

[Jersey] Re: running a parallel polling thread when the webapp gets deployed

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Fri, 10 Feb 2012 13:08:17 +0100

You may want to consider using some additional enterprise features of
JavaEE container, such as timer service:
http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html

Also, you should consider sending your follow-up questions to the
users_at_jersey.java.net rather than the old & deprecated
users_at_jersey.dev.java.net mailing list... :)

HTH,
Marek

On Fri 10 Feb 2012 10:57:42 AM CET, tmp wrote:
> perhaps i have to get more specific :)
>
> i have a root resource A.
> this resource is called whenever a client tries to access the resource. if i
> instantiate a class B in the constructor of the resource A, this class will
> be instantiated every time a client accesses my webapplication.
>
> what i need is a class that is instantiated only once (when the webapp is
> deployed) and runs all the time.
>
> why:
> the resources of my webapplication write into a database. now i need a
> mailing service that sends emails according to the data in the database. so
> i need only one instantiation of the mailing service that polls the database
> all the time.
>
>
> do you have any ideas, how i can achieve that? thanks in advance
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/running-a-parallel-polling-thread-when-the-webapp-gets-deployed-tp7269447p7272149.html
> Sent from the Jersey mailing list archive at Nabble.com.