Timer managers
The timer manager combines the functions of the asynchronous beans alarm manager and asynchronous scope. So, when a timer manager is created, it internally uses an asynchronous scope to provide the timer manager life cycle functions.
You can look up the timer manager in the Java™ Naming and Directory Interface (JNDI) name space. This capability is different from the alarm manager that is retrieved through the asynchronous beans scope. Each lookup of the timer manager returns a new logical timer manager that can be destroyed independently of all other timer managers.
A timer manager can be configured with a number of thread pools through the administrative console. For deployment you can bind this timer manager to a resource reference at assembly time, so the resource reference can be used by the application to look up the timer manager.
InitialContext ic = new InitialContext();
TimerManager tm = (TimerManager)ic.lookup("java:comp/env/tm/TimerManager");The programming model for setting up the alarm listener and the timer listener is different. The following code example shows that difference.
| Asynchronous beans | CommonJ |
|---|---|
|
|
application.xml within the java:app or java:global contexts. For example, your
application.xml file should look similar to the
following:<res-ref-name>java:app/env/timerManger</res-ref-name>and the
ibm-application-bnd.xml file should contain something similar to the
following:<resource-ref-name="java:app/env/timerManager" binding-name="tm/default"/>Ensure
that your Spring configuration file contains a similar
value:value="java:app/env/timerManager"