Search in sources :

Example 6 with ManagedExecutorService

use of org.glassfish.concurrent.config.ManagedExecutorService in project Payara by payara.

the class ManagedExecutorServiceDeployer method deployResource.

@Override
public void deployResource(Object resource) throws Exception {
    ManagedExecutorService managedExecutorServiceResource = (ManagedExecutorService) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(managedExecutorServiceResource);
    deployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Also used : ManagedExecutorService(org.glassfish.concurrent.config.ManagedExecutorService) ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo)

Example 7 with ManagedExecutorService

use of org.glassfish.concurrent.config.ManagedExecutorService in project Payara by payara.

the class ManagedExecutorServiceDeployer method deployResource.

@Override
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    ManagedExecutorService managedExecutorServiceRes = (ManagedExecutorService) resource;
    if (managedExecutorServiceRes == null) {
        _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedExecutorService");
        return;
    }
    String jndiName = managedExecutorServiceRes.getJndiName();
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "ManagedExecutorServiceDeployer.deployResource() : jndi-name [" + jndiName + "], ");
    }
    ResourceInfo resourceInfo = new ResourceInfo(managedExecutorServiceRes.getJndiName(), applicationName, moduleName);
    ManagedExecutorServiceConfig config = new ManagedExecutorServiceConfig(managedExecutorServiceRes);
    javax.naming.Reference ref = new javax.naming.Reference(javax.enterprise.concurrent.ManagedExecutorService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null);
    RefAddr addr = new SerializableObjectRefAddr(ManagedExecutorServiceConfig.class.getName(), config);
    ref.add(addr);
    RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo);
    ref.add(resAddr);
    try {
        // Publish the object ref
        namingService.publishObject(resourceInfo, ref, true);
    } catch (NamingException ex) {
        LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedExecutorService", jndiName);
    }
    registerMonitorableComponent(managedExecutorServiceRes);
}
Also used : RefAddr(javax.naming.RefAddr) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) ManagedExecutorService(org.glassfish.concurrent.config.ManagedExecutorService) ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) NamingException(javax.naming.NamingException)

Aggregations

ManagedExecutorService (org.glassfish.concurrent.config.ManagedExecutorService)7 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 Resource (com.sun.enterprise.config.serverbeans.Resource)1 Resources (com.sun.enterprise.config.serverbeans.Resources)1 NamingException (javax.naming.NamingException)1 RefAddr (javax.naming.RefAddr)1 ActionReport (org.glassfish.api.ActionReport)1 DefaultResourceProxy (org.glassfish.api.naming.DefaultResourceProxy)1 ManagedExecutorServiceBase (org.glassfish.concurrent.config.ManagedExecutorServiceBase)1 DefaultManagedExecutorService (org.glassfish.concurrent.runtime.deployer.DefaultManagedExecutorService)1 ResourceStatus (org.glassfish.resourcebase.resources.api.ResourceStatus)1 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)1 SingleConfigCode (org.jvnet.hk2.config.SingleConfigCode)1 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)1