Here are the key things I learned about the EJB3 timer service and WebSphere:
- Timers are persistent and managed by the EJB container. Once created, timers will survive a server restart. This means you need to be careful about how and when you create your timers.
- The default WAS Timer Service poll interval is 300 seconds (five minutes). If you require your timers to tick more frequently you'll need to lower the poll interval.
- By default, WAS uses a single thread to service EJB timer tasks. This means WAS can handle one concurrent timer task. If you require more concurrently active timers, you'll need to increase the number of timer threads.
- WAS ships two very useful utilities that can help you diagnose strange timer service behaviour: findEJBTimers shows you all timers for a given server and cancelEJBTimers enables you to cancel either a specific timer or all timers registered to a given server.
For this particular application we achieved success by reducing the poll interval from 300 to 10 and increasing the number of timer threads from 1 to 10.
To edit the EJB timer service settings, first navigate to the application server you want to modify, and then in the "Container Settings" section, expand "EJB Container Settings" and then click "EJB timer service settings". You will then see this screen: