use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ConcurrentRuntimeTest method testParseContextInfo.
@Test
public void testParseContextInfo() throws Exception {
expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
expect(contextServiceConfig.getContextInfo()).andReturn("Classloader, JNDI, Security, WorkArea").anyTimes();
expect(contextServiceConfig.getContextInfoEnabled()).andReturn("true");
replay(contextServiceConfig);
ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime();
ResourceInfo resource = new ResourceInfo("test");
ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig);
ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider();
assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "security"));
assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "workArea"));
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedExecutorServiceDeployer method undeployResource.
@Override
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
ManagedExecutorService managedExecutorServiceRes = (ManagedExecutorService) resource;
ResourceInfo resourceInfo = new ResourceInfo(managedExecutorServiceRes.getJndiName(), applicationName, moduleName);
namingService.unpublishObject(resourceInfo, managedExecutorServiceRes.getJndiName());
unregisterMonitorableComponent();
// stop the runtime object
concurrentRuntime.shutdownManagedExecutorService(managedExecutorServiceRes.getJndiName());
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo 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());
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo 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);
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedScheduledExecutorServiceDeployer method undeployResource.
@Override
public void undeployResource(Object resource) throws Exception {
ManagedScheduledExecutorService ManagedScheduledExecutorServiceResource = (ManagedScheduledExecutorService) resource;
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedScheduledExecutorServiceResource);
undeployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Aggregations