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

From: Marek Potociar <>
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:

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


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:
> Sent from the Jersey mailing list archive at