© Michael Müller 2018
Michael MüllerPractical JSF in Java EE 8 https://doi.org/10.1007/978-1-4842-3030-5_31

31. Scheduled Tasks

Michael Müller1 
(1)
Brühl, Nordrhein-Westfalen, Germany
 

If a user doesn’t activate their account, we’ll get an orphaned registration (or account). We have to clean up the database periodically, and what works better for periodically jobs than a timer? This is where scheduled tasks come into play. Because timers can be very sensitive to errors within the same thread, we’ll do this scheduling asynchronously.

Scheduler

Timers are available within Enterprise Java Beans (EJBs). Alumni uses a central class to invoke timed events: the Scheduler class, annotated as @Singleton. Any method that should be invoked by a timer will be ...

Get Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.