use of com.sun.ejb.containers.EJBTimerService in project Payara by payara.
the class PersistentEJBTimerService method initEJBTimerService.
static void initEJBTimerService(String target) {
EJBTimerService ts = null;
EjbContainerUtil _ejbContainerUtil = EjbContainerUtilImpl.getInstance();
EjbTimerService _ejbt = _ejbContainerUtil.getEjbTimerService(target);
String resourceName = getTimerResource(_ejbt);
File root = _ejbContainerUtil.getServerContext().getInstallRoot();
boolean is_upgrade = isUpgrade(resourceName, _ejbt, root);
File rootScratchDir = _ejbContainerUtil.getServerEnvironment().getApplicationStubPath();
File appScratchFile = new File(rootScratchDir, TIMER_SERVICE_APP_NAME);
// Remember the value before the file is created during deploy
boolean removeOldTimers = is_upgrade && !appScratchFile.exists();
boolean available = _ejbContainerUtil.getDeployment().isRegistered(TIMER_SERVICE_APP_NAME);
if (available) {
logger.log(Level.WARNING, "EJBTimerService had been explicitly deployed.");
} else {
if (resourceName != null) {
available = deployEJBTimerService(root, appScratchFile, resourceName, is_upgrade);
} else {
logger.log(Level.WARNING, "Cannot deploy EJBTimerService: Timer resource for target " + target + " is not available");
}
}
if (available) {
try {
ts = new PersistentEJBTimerService("java:global/" + TIMER_SERVICE_APP_NAME + "/" + TIMER_SERVICE_BEAN_NAME, removeOldTimers);
logger.log(Level.INFO, "ejb.timer_service_started", new Object[] { resourceName });
} catch (Exception ex) {
logger.log(Level.WARNING, "ejb.timer_service_init_error", ex);
}
}
EJBTimerService.setEJBTimerService(ts);
}
Aggregations