Over the past years, I always used EJB Timer Service to implement scheduled tasks in my Java Enterprise applications. Since Java EE7, the ManagedScheduledExecutorService
is a new pattern to implement a scheduler service. The ManagedScheduledExecutorService
is part of the SE ScheduledExecutorService
and provides methods for submitting delayed or periodic tasks for execution.
Implementing a ManagedScheduledExecutorService
is quite simple. See the following example: