Troubleshooting
Problem
While using IBM Rational Application Developer for WebSphere Software v7.5.2 with WebSphere Application Server v7.0.0.1, a Single Interval EJB 3.0 Timer in a Local Interface Stateless Session Bean does not invoke @Timeout callback method when it expires.
Cause
Unknown.
Defect APAR PK73068 is likely a component related to this issue.
Environment
// Example of a simple stateless session ejb 3.0 with Single Interval Timer
package ejbtm;
import java.util.Date;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
/**
* Session Bean implementation class MyTimerEJB
*/
@Stateless
public class MyTimerEJB implements MyTimer
{
/**
* Default constructor.
*/
public MyTimerEJB() {
// constructor stub
}
private static final Logger log = Logger.getLogger(MyTimerEJB.class.getName());
private static final String TM_NAME = "MyTestTimer";
@Resource
TimerService timerService;
@Timeout
public void myTimeout(Timer timer)
{
// Why is it not called when MyTestTimer expires?
System.out.println("Timeout myTimeout() called");
System.out.println("... called at: " + new Date(System.currentTimeMillis()));
log.info("Timer fired: timer=" + timer.getInfo());
}
public void startTimer()
{
log.info("Start timer");
log.info("...but first Stop any timers");
stopTimer();
// Create time expiring in 10 sec
long duration = 1000 * 10;
Timer timer = timerService.createTimer(duration, TM_NAME);
System.out.println("Created Timer at : " + new Date(System.currentTimeMillis()));
log.info("Timer created: timer=" + timer.getInfo());
log.info("TimeRemaining=" + timer.getTimeRemaining());
log.info("Next timeout=" + timer.getNextTimeout());
}
public void stopTimer()
{
log.info("Stop timer");
for (Object tm : timerService.getTimers()) {
Timer timer = (Timer)tm;
log.info("Cancel timer: timer=" + timer.getInfo());
timer.cancel();
}
}
public void printTimer()
{
log.info("Print timer");
for (Object tm : timerService.getTimers()) {
Timer timer = (Timer)tm;
log.info("timer=" + timer.getInfo());
}
}
}
Resolving The Problem
Upgrade to WebSphere Application Server v7.0.0.3 for Rational Application Developer v7.5.x using the Installation Manager:Updater, resolved this problem.
Note: This Timer related APAR fix in WebSphere Application Server 7.0.0.3 for single interval timers, along with other non-APAR defect fixes may have contributed to the resolution. If upgrading to the latest available WebSphere Application Server 7.0.0.x FixPack does not help, you may have a new issue and
IBM Support for WebSphere Application Server should be contacted.
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21388449