I have to implement a simple (not clustered) timer for WebLogic and it seems there are two different 'standard' options
Does anyone have any advice on using the CommonJ TimerManager versus using the EJB3 TimerService in WebLogic 10.0?
Thank you.
CommonJ was originally proposed under JSR 237, which was withdrawn in 2008 and merged into JSR 236 Concurrency Utilities for the Java EE platform. Note that this means a significant change from CommonJ proposed standard and API. The name CommonJ is removed, the new packages are under javax.enterprise.concurrent, rather than commonj.timers and commonj.work, and the original classes TimerManager, Timer and TimerListener are replaced by non-corresponding interfaces/classes including ManagedScheduledExecutorService, ManagedTask, ManagedTaskListener, Trigger.
This latter JSR 236 has recently passed public review and, hence, should become a standard soon. As of november 2012, it is a preliminary candidate for inclusion under the Java EE 7 specification (JSR 342), but this will be confirmed once 342 is finalised and released.
Hence, the following problems with CommonJ:
I suggest you use the EJB 3.0 Timer Service if it meets your needs.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With