use of org.glassfish.concurrent.config.ManagedThreadFactory in project Payara by payara.
the class ManagedThreadFactoryManager method createConfigBean.
private ManagedThreadFactory createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
ManagedThreadFactory managedThreadFactory = param.createChild(ManagedThreadFactory.class);
managedThreadFactory.setJndiName(jndiName);
if (description != null) {
managedThreadFactory.setDescription(description);
}
managedThreadFactory.setContextInfoEnabled(contextInfoEnabled);
managedThreadFactory.setContextInfo(contextInfo);
managedThreadFactory.setThreadPriority(threadPriority);
managedThreadFactory.setEnabled(enabled);
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = managedThreadFactory.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
managedThreadFactory.getProperty().add(prop);
}
}
return managedThreadFactory;
}
use of org.glassfish.concurrent.config.ManagedThreadFactory 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);
}
}
use of org.glassfish.concurrent.config.ManagedThreadFactory in project Payara by payara.
the class ManagedThreadFactoryDeployer method undeployResource.
@Override
public void undeployResource(Object resource) throws Exception {
ManagedThreadFactory ManagedThreadFactoryResource = (ManagedThreadFactory) resource;
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedThreadFactoryResource);
undeployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Aggregations