Search in sources :

Example 6 with EJBTimerService

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);
}
Also used : EjbContainerUtil(com.sun.ejb.containers.EjbContainerUtil) EJBTimerService(com.sun.ejb.containers.EJBTimerService) EjbTimerService(org.glassfish.ejb.config.EjbTimerService) File(java.io.File) PropertyVetoException(java.beans.PropertyVetoException) EJBException(javax.ejb.EJBException) FinderException(javax.ejb.FinderException) CreateException(javax.ejb.CreateException)

Aggregations

EJBTimerService (com.sun.ejb.containers.EJBTimerService)6 IASSecurityException (com.sun.enterprise.security.util.IASSecurityException)2 DeploymentException (org.glassfish.deployment.common.DeploymentException)2 EjbContainerUtil (com.sun.ejb.containers.EjbContainerUtil)1 PropertyVetoException (java.beans.PropertyVetoException)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 Set (java.util.Set)1 CreateException (javax.ejb.CreateException)1 EJBException (javax.ejb.EJBException)1 FinderException (javax.ejb.FinderException)1 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)1 OpsParams (org.glassfish.api.deployment.OpsParams)1 UndeployCommandParameters (org.glassfish.api.deployment.UndeployCommandParameters)1 DeploymentProperties (org.glassfish.deployment.common.DeploymentProperties)1 EjbTimerService (org.glassfish.ejb.config.EjbTimerService)1 EJBSecurityManager (org.glassfish.ejb.security.application.EJBSecurityManager)1 EngineRef (org.glassfish.internal.data.EngineRef)1