Search in sources :

Example 1 with NonBlockingPool

use of com.sun.ejb.containers.util.pool.NonBlockingPool in project Payara by payara.

the class StatelessSessionContainer method createBeanPool.

protected void createBeanPool() {
    ObjectFactory sessionCtxFactory = new SessionContextFactory();
    iased = ejbDescriptor.getIASEjbExtraDescriptors();
    if (iased != null) {
        beanPoolDes = iased.getBeanPool();
    }
    poolProp = new PoolProperties(ejbContainer, beanPoolDes);
    String val = ejbDescriptor.getEjbBundleDescriptor().getEnterpriseBeansProperty(SINGLETON_BEAN_POOL_PROP);
    if (poolProp.maxWaitTimeInMillis != -1) {
        pool = new BlockingPool(getContainerId(), ejbDescriptor.getName(), sessionCtxFactory, poolProp.steadyPoolSize, poolProp.poolResizeQuantity, poolProp.maxPoolSize, poolProp.poolIdleTimeoutInSeconds, loader, Boolean.parseBoolean(val), poolProp.maxWaitTimeInMillis);
    } else {
        pool = new NonBlockingPool(getContainerId(), ejbDescriptor.getName(), sessionCtxFactory, poolProp.steadyPoolSize, poolProp.poolResizeQuantity, poolProp.maxPoolSize, poolProp.poolIdleTimeoutInSeconds, loader, Boolean.parseBoolean(val));
    }
}
Also used : ObjectFactory(com.sun.ejb.containers.util.pool.ObjectFactory) NonBlockingPool(com.sun.ejb.containers.util.pool.NonBlockingPool) BlockingPool(com.sun.ejb.containers.util.pool.BlockingPool) NonBlockingPool(com.sun.ejb.containers.util.pool.NonBlockingPool)

Example 2 with NonBlockingPool

use of com.sun.ejb.containers.util.pool.NonBlockingPool in project Payara by payara.

the class ActiveTxCache method initializeHome.

/**
 * Called from the ContainerFactory during initialization.
 */
protected void initializeHome() throws Exception {
    ObjectFactory entityCtxFactory = new EntityContextFactory(this);
    int steadyPoolSize = 0;
    int resizeQuantity = 10;
    int idleTimeoutInSeconds = Integer.MAX_VALUE - 1;
    poolProp = new PoolProperties(this);
    super.initializeHome();
    entityCtxPool = new NonBlockingPool(getContainerId(), ejbDescriptor.getName(), entityCtxFactory, poolProp.steadyPoolSize, poolProp.poolResizeQuantity, poolProp.maxPoolSize, poolProp.poolIdleTimeoutInSeconds, loader);
    registerMonitorableComponents();
}
Also used : ObjectFactory(com.sun.ejb.containers.util.pool.ObjectFactory) NonBlockingPool(com.sun.ejb.containers.util.pool.NonBlockingPool)

Example 3 with NonBlockingPool

use of com.sun.ejb.containers.util.pool.NonBlockingPool in project Payara by payara.

the class MessageBeanContainer method createMessageBeanPool.

private void createMessageBeanPool(EjbMessageBeanDescriptor descriptor) {
    beanPoolDesc_ = descriptor.getIASEjbExtraDescriptors().getBeanPool();
    if (beanPoolDesc_ == null) {
        beanPoolDesc_ = new BeanPoolDescriptor();
    }
    MdbContainer mdbc = ejbContainerUtilImpl.getServices().<Config>getService(Config.class, ServerEnvironment.DEFAULT_INSTANCE_NAME).getExtensionByType(MdbContainer.class);
    int maxPoolSize = beanPoolDesc_.getMaxPoolSize();
    if (maxPoolSize < 0) {
        maxPoolSize = stringToInt(mdbc.getMaxPoolSize(), appEJBName_, _logger);
    }
    maxPoolSize = validateValue(maxPoolSize, 1, -1, DEFAULT_MAX_POOL_SIZE, "max-pool-size", appEJBName_, _logger);
    beanPoolDesc_.setMaxPoolSize(maxPoolSize);
    int value = beanPoolDesc_.getSteadyPoolSize();
    if (value < 0) {
        value = stringToInt(mdbc.getSteadyPoolSize(), appEJBName_, _logger);
    }
    value = validateValue(value, 0, maxPoolSize, DEFAULT_STEADY_SIZE, "steady-pool-size", appEJBName_, _logger);
    beanPoolDesc_.setSteadyPoolSize(value);
    value = beanPoolDesc_.getPoolResizeQuantity();
    if (value < 0) {
        value = stringToInt(mdbc.getPoolResizeQuantity(), appEJBName_, _logger);
    }
    value = validateValue(value, 1, maxPoolSize, DEFAULT_RESIZE_QUANTITY, "pool-resize-quantity", appEJBName_, _logger);
    beanPoolDesc_.setPoolResizeQuantity(value);
    // if ejb pool idle-timeout-in-seconds is not explicitly set in
    // glassfish-ejb-jar.xml, returned value is -1
    value = beanPoolDesc_.getPoolIdleTimeoutInSeconds();
    if (value < MIN_IDLE_TIMEOUT) {
        value = stringToInt(mdbc.getIdleTimeoutInSeconds(), appEJBName_, _logger);
    }
    value = validateValue(value, MIN_IDLE_TIMEOUT, -1, DEFAULT_IDLE_TIMEOUT, "idle-timeout-in-seconds", appEJBName_, _logger);
    beanPoolDesc_.setPoolIdleTimeoutInSeconds(value);
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, appEJBName_ + ": Setting message-driven bean pool max-pool-size=" + beanPoolDesc_.getMaxPoolSize() + ", steady-pool-size=" + beanPoolDesc_.getSteadyPoolSize() + ", pool-resize-quantity=" + beanPoolDesc_.getPoolResizeQuantity() + ", idle-timeout-in-seconds=" + beanPoolDesc_.getPoolIdleTimeoutInSeconds());
    }
    // Create a non-blocking pool of message bean instances.
    // The protocol manager implementation enforces a limit
    // on message bean resources independent of the pool.
    ObjectFactory objFactory = new MessageBeanContextFactory();
    String val = descriptor.getEjbBundleDescriptor().getEnterpriseBeansProperty(SINGLETON_BEAN_POOL_PROP);
    messageBeanPool_ = new NonBlockingPool(getContainerId(), appEJBName_, objFactory, beanPoolDesc_.getSteadyPoolSize(), beanPoolDesc_.getPoolResizeQuantity(), beanPoolDesc_.getMaxPoolSize(), beanPoolDesc_.getPoolIdleTimeoutInSeconds(), loader, Boolean.parseBoolean(val));
}
Also used : MdbContainer(org.glassfish.ejb.config.MdbContainer) ObjectFactory(com.sun.ejb.containers.util.pool.ObjectFactory) NonBlockingPool(com.sun.ejb.containers.util.pool.NonBlockingPool) Config(com.sun.enterprise.config.serverbeans.Config) BeanPoolDescriptor(com.sun.enterprise.deployment.runtime.BeanPoolDescriptor) MessageEndpoint(javax.resource.spi.endpoint.MessageEndpoint)

Aggregations

NonBlockingPool (com.sun.ejb.containers.util.pool.NonBlockingPool)3 ObjectFactory (com.sun.ejb.containers.util.pool.ObjectFactory)3 BlockingPool (com.sun.ejb.containers.util.pool.BlockingPool)1 Config (com.sun.enterprise.config.serverbeans.Config)1 BeanPoolDescriptor (com.sun.enterprise.deployment.runtime.BeanPoolDescriptor)1 MessageEndpoint (javax.resource.spi.endpoint.MessageEndpoint)1 MdbContainer (org.glassfish.ejb.config.MdbContainer)1