try {
timer = new TimerState (timerId, containerId, applicationId, ownerId,
timedObjectPrimaryKey, initialExpiration,
intervalDuration, schedule, timerConfig.getInfo());
} catch(IOException ioe) {
CreateException ce = new CreateException();
ce.initCause(ioe);
throw ce;
}
if( logger.isLoggable(Level.FINE) ) {
logger.log(Level.FINE, "TimerBean.createTimer() ::timerId=" +
timer.getTimerId() + " ::containerId=" + timer.getContainerId() +
" ::applicationId=" + timer.getApplicationId() +
" ::timedObjectPK=" + timedObjectPrimaryKey +
" ::info=" + timerConfig.getInfo() +
" ::schedule=" + timer.getSchedule() +
" ::persistent=" + timerConfig.isPersistent() +
" ::initialExpiration=" + initialExpiration +
" ::intervalDuration=" + intervalDuration +
" :::state=" + timer.stateToString() +
" :::creationTime=" + timer.getCreationTime() +
" :::ownerId=" + timer.getOwnerId());
}
//
// Only proceed with transactional semantics if this timer
// is owned by the current server instance. NOTE that this
// will *ALWAYS* be the case for timers created from EJB
// applications via the javax.ejb.EJBTimerService.create methods.
//
// For testing purposes, ejbCreate takes an ownerId parameter,
// which allows us to easily simulate other server instances
// by creating timers for them. In those cases, we don't need
// the timer transaction semantics and ejbTimeout logic. Simulating
// the creation of timers for the same application and different
// server instances from a script is difficult since the
// containerId is not generated until after deployment.
//
try {
EJBTimerService.getEJBTimerService().addTimerSynchronization((EJBContextImpl)context_,
timerId, initialExpiration, containerId, ownerId);
} catch(Exception e) {
CreateException ce = new CreateException();
ce.initCause(e);
throw ce;
}
em.persist(timer);
return timer;