Search in sources :

Example 1 with EjbContainer

use of org.glassfish.ejb.config.EjbContainer in project Payara by payara.

the class EJBTimerService method initProperties.

private void initProperties() {
    try {
        // Check for property settings from domain.xml
        EjbContainer ejbc = ejbContainerUtil.getEjbContainer();
        EjbTimerService ejbt = ejbc.getEjbTimerService();
        if (ejbt != null) {
            String valString = ejbt.getMinimumDeliveryIntervalInMillis();
            long val = (valString != null) ? Long.parseLong(valString) : -1;
            if (val > 0) {
                minimumDeliveryInterval_ = val;
            }
            valString = ejbt.getMaxRedeliveries();
            val = (valString != null) ? Long.parseLong(valString) : -1;
            // EJB 2.1 specification minimum is 1
            if (val > 0) {
                maxRedeliveries_ = val;
            }
            valString = ejbt.getRedeliveryIntervalInternalInMillis();
            val = (valString != null) ? Long.parseLong(valString) : -1;
            if (val > 0) {
                redeliveryInterval_ = val;
            }
            rescheduleFailedTimer = Boolean.valueOf(ejbt.getPropertyValue(RESCHEDULE_FAILED_TIMER));
            // Load confing listener
            ejbContainerUtil.getServices().getService(EJBTimerServiceConfigListener.class);
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Exception converting timer service " + "domain.xml properties.  Defaults will be used instead.", e);
    }
    logger.log(Level.FINE, "EJB Timer Service properties : " + "min delivery interval = " + getMinimumDeliveryInterval() + "\nmax redeliveries = " + maxRedeliveries_ + "\nredelivery interval = " + getRedeliveryInterval());
}
Also used : EjbContainer(org.glassfish.ejb.config.EjbContainer) EjbTimerService(org.glassfish.ejb.config.EjbTimerService) FinderException(javax.ejb.FinderException) EJBException(javax.ejb.EJBException) CreateException(javax.ejb.CreateException)

Example 2 with EjbContainer

use of org.glassfish.ejb.config.EjbContainer in project Payara by payara.

the class PersistentEJBTimerService method initProperties.

private void initProperties() {
    try {
        // Check for property settings from domain.xml
        EjbContainer ejbc = ejbContainerUtil.getEjbContainer();
        ejbt = ejbc.getEjbTimerService();
        if (ejbt != null) {
            // If the system property com.sun.ejb.timer.ReadDBBeforeTimeout
            // is defined by the user use that the value of the flag
            // performDBReadBeforeTimeout
            foundSysPropDBReadBeforeTimeout = getDBReadBeforeTimeoutProperty();
            operationOnConnectionFailure = ejbt.getPropertyValue(ON_CONECTION_FAILURE);
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Exception converting timer service " + "domain.xml properties.  Defaults will be used instead.", e);
    }
}
Also used : EjbContainer(org.glassfish.ejb.config.EjbContainer) PropertyVetoException(java.beans.PropertyVetoException) EJBException(javax.ejb.EJBException) FinderException(javax.ejb.FinderException) CreateException(javax.ejb.CreateException)

Example 3 with EjbContainer

use of org.glassfish.ejb.config.EjbContainer in project Payara by payara.

the class EjbContainerUtilImpl method postConstruct.

@Override
public void postConstruct() {
    ejbContainer = serverConfig.getExtensionByType(EjbContainer.class);
    ClassLoader ejbImplClassLoader = EjbContainerUtilImpl.class.getClassLoader();
    if (callFlowAgent == null) {
        callFlowAgent = (Agent) Proxy.newProxyInstance(ejbImplClassLoader, new Class[] { Agent.class }, new InvocationHandler() {

            @Override
            public Object invoke(Object proxy, Method m, Object[] args) {
                return null;
            }
        });
    }
    defaultThreadPoolExecutor = createThreadPoolExecutor(DEFAULT_THREAD_POOL_NAME);
    // avoid starting JDK timer in application class loader.  The life of _timer
    // field is longer than deployed apps, and any reference to app class loader
    // in JDK timer thread will cause class loader leak.  Issue 17468
    ClassLoader originalClassLoader = null;
    try {
        originalClassLoader = Utility.setContextClassLoader(ejbImplClassLoader);
        _timer = new Timer("EJB Container Timer", true);
    } finally {
        if (originalClassLoader != null) {
            Utility.setContextClassLoader(originalClassLoader);
        }
    }
    EJBObjectOutputStreamHandler.setJavaEEIOUtils(javaEEIOUtils);
    javaEEIOUtils.addGlassFishOutputStreamHandler(new EJBObjectOutputStreamHandler());
    javaEEIOUtils.addGlassFishInputStreamHandler(new EJBObjectInputStreamHandler());
    _me = this;
}
Also used : EjbContainer(org.glassfish.ejb.config.EjbContainer) Timer(java.util.Timer) EJBObjectOutputStreamHandler(com.sun.ejb.base.io.EJBObjectOutputStreamHandler) EJBObjectInputStreamHandler(com.sun.ejb.base.io.EJBObjectInputStreamHandler) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler)

Aggregations

EjbContainer (org.glassfish.ejb.config.EjbContainer)3 CreateException (javax.ejb.CreateException)2 EJBException (javax.ejb.EJBException)2 FinderException (javax.ejb.FinderException)2 EJBObjectInputStreamHandler (com.sun.ejb.base.io.EJBObjectInputStreamHandler)1 EJBObjectOutputStreamHandler (com.sun.ejb.base.io.EJBObjectOutputStreamHandler)1 PropertyVetoException (java.beans.PropertyVetoException)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 Timer (java.util.Timer)1 EjbTimerService (org.glassfish.ejb.config.EjbTimerService)1