Search in sources :

Example 6 with SerializableObjectRefAddr

use of org.glassfish.resources.naming.SerializableObjectRefAddr in project Payara by payara.

the class ManagedScheduledExecutorServiceDeployer method deployResource.

@Override
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    ManagedScheduledExecutorService managedScheduledExecutorServiceRes = (ManagedScheduledExecutorService) resource;
    if (managedScheduledExecutorServiceRes == null) {
        _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedScheduledExecutorService");
        return;
    }
    String jndiName = managedScheduledExecutorServiceRes.getJndiName();
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "ManagedScheduledExecutorServiceDeployer.deployResource() : jndi-name [" + jndiName + "]");
    }
    ResourceInfo resourceInfo = new ResourceInfo(managedScheduledExecutorServiceRes.getJndiName(), applicationName, moduleName);
    ManagedScheduledExecutorServiceConfig config = new ManagedScheduledExecutorServiceConfig(managedScheduledExecutorServiceRes);
    javax.naming.Reference ref = new javax.naming.Reference(javax.enterprise.concurrent.ManagedScheduledExecutorService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null);
    RefAddr addr = new SerializableObjectRefAddr(ManagedScheduledExecutorServiceConfig.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, "ManagedScheduledExecutorService", jndiName);
    }
    registerMonitorableComponent(managedScheduledExecutorServiceRes);
}
Also used : RefAddr(javax.naming.RefAddr) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) NamingException(javax.naming.NamingException) ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService)

Example 7 with SerializableObjectRefAddr

use of org.glassfish.resources.naming.SerializableObjectRefAddr in project Payara by payara.

the class ManagedThreadFactoryDeployer method deployResource.

@Override
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    ManagedThreadFactory ManagedThreadFactoryRes = (ManagedThreadFactory) resource;
    if (ManagedThreadFactoryRes == null) {
        _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedThreadFactory");
        return;
    }
    String jndiName = ManagedThreadFactoryRes.getJndiName();
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "ManagedThreadFactoryDeployer.deployResource() : jndi-name [" + jndiName + "]");
    }
    ResourceInfo resourceInfo = new ResourceInfo(ManagedThreadFactoryRes.getJndiName(), applicationName, moduleName);
    ManagedThreadFactoryConfig config = new ManagedThreadFactoryConfig(ManagedThreadFactoryRes);
    javax.naming.Reference ref = new javax.naming.Reference(javax.enterprise.concurrent.ManagedThreadFactory.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null);
    RefAddr addr = new SerializableObjectRefAddr(ManagedThreadFactoryConfig.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, "ManagedThreadFactory", jndiName);
    }
}
Also used : RefAddr(javax.naming.RefAddr) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) NamingException(javax.naming.NamingException) ManagedThreadFactory(org.glassfish.concurrent.config.ManagedThreadFactory)

Aggregations

NamingException (javax.naming.NamingException)7 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)7 RefAddr (javax.naming.RefAddr)5 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)5 StringRefAddr (javax.naming.StringRefAddr)2 ResourceConflictException (org.glassfish.resourcebase.resources.api.ResourceConflictException)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 ConnectorNamingEvent (com.sun.appserv.connectors.internal.spi.ConnectorNamingEvent)1 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)1 ConnectorDescriptorInfo (com.sun.enterprise.connectors.ConnectorDescriptorInfo)1 MailConfiguration (com.sun.enterprise.deployment.MailConfiguration)1 ResourceProperty (com.sun.enterprise.repository.ResourceProperty)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 Context (javax.naming.Context)1 Reference (javax.naming.Reference)1 InitialContextFactory (javax.naming.spi.InitialContextFactory)1 ContextService (org.glassfish.concurrent.config.ContextService)1 ManagedExecutorService (org.glassfish.concurrent.config.ManagedExecutorService)1 ManagedScheduledExecutorService (org.glassfish.concurrent.config.ManagedScheduledExecutorService)1