Search code examples
jakarta-eetimerejb-3.0weblogiccommonj

CommonJ TimerManager versus EJB3 TimerService


I have to implement a simple (not clustered) timer for WebLogic and it seems there are two different 'standard' options

  • Timer and Work Manager API (CommonJ)
  • EJB3.0 TimerService

Does anyone have any advice on using the CommonJ TimerManager versus using the EJB3 TimerService in WebLogic 10.0?

Thank you.


Solution

  • TimerService in EJB 3.0 is somewhat limited as compared to CommonJ Timer Manager. For example, it requires boilerplate code and container-specific configuration to implement flexible task scheduling. This was simplified with the introduction of @Scheduled annotation in EJB 3.1.

    If you are stick with EJB 3.0 and need easily and flexibly configurable task scheduling, CommonJ Timer Manager API is a viable option.

    In addition, Task Scheduler from Spring Framework (org.springframework.scheduling.TaskScheduler) does a good job of abstracting Timer Manager API and allows declarative configuration using cron expressions.