Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Background thread in Jetty

Hi,
On Tue, Jun 19, 2018 at 4:35 PM Josh Spiegel <joshlakewg@xxxxxxxxx> wrote:
>
> Hi,
>
> I am using Jetty and I would like to create a background task that periodically wakes up and checks on some cached state, possibly doing some cleanup.  I see several ways to do this but I am not sure what the best practice is.  One idea is to use Jetty's scheduler service (i.e. schedule the task to wake up and have it continuously reschedule itself when it is done).  Does anybody know if this is a reasonable approach?

Yes it is.
It has the added benefit that its lifecycle will be bound to that of
Jetty and you don't have to write shutdown code for your own thread.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top