use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.
the class DefaultStatefulBeanAccessTimeoutWriteHandler method updateOrCreateDefaultStatefulBeanAccessTimeoutService.
void updateOrCreateDefaultStatefulBeanAccessTimeoutService(final OperationContext context, final ModelNode model) throws OperationFailedException {
final long defaultAccessTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_STATEFUL_BEAN_ACCESS_TIMEOUT.resolveModelAttribute(context, model).asLong();
final ServiceName serviceName = DefaultAccessTimeoutService.STATEFUL_SERVICE_NAME;
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceController<?> sc = registry.getService(serviceName);
if (sc != null) {
final DefaultAccessTimeoutService defaultAccessTimeoutService = DefaultAccessTimeoutService.class.cast(sc.getValue());
defaultAccessTimeoutService.setDefaultAccessTimeout(defaultAccessTimeout);
} else {
// create and install the service
final DefaultAccessTimeoutService defaultAccessTimeoutService = new DefaultAccessTimeoutService(defaultAccessTimeout);
final ServiceController<?> newService = context.getServiceTarget().addService(serviceName, defaultAccessTimeoutService).install();
}
}
use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.
the class ExceptionLoggingWriteHandler method updateOrCreateDefaultExceptionLoggingEnabledService.
void updateOrCreateDefaultExceptionLoggingEnabledService(final OperationContext context, final ModelNode model) throws OperationFailedException {
final boolean enabled = EJB3SubsystemRootResourceDefinition.LOG_EJB_EXCEPTIONS.resolveModelAttribute(context, model).asBoolean();
final ServiceName serviceName = LoggingInterceptor.LOGGING_ENABLED_SERVICE_NAME;
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceController sc = registry.getService(serviceName);
if (sc != null) {
final AtomicBoolean value = (AtomicBoolean) sc.getValue();
value.set(enabled);
} else {
// create and install the service
final ValueService<AtomicBoolean> service = new ValueService<>(new ImmediateValue<>(new AtomicBoolean(enabled)));
context.getServiceTarget().addService(serviceName, service).install();
}
}
use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.
the class TransactionJndiBindingProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
//if this is a war we need to bind to the modules comp namespace
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
bindServices(deploymentUnit, serviceTarget, moduleContextServiceName);
}
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
if (component.getNamingMode() == ComponentNamingMode.CREATE) {
final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
bindServices(deploymentUnit, serviceTarget, compContextServiceName);
}
}
}
use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.
the class TransactionLeakRollbackProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServiceName serviceName = deploymentUnit.getServiceName().append(SERVICE_NAME);
final TransactionRollbackSetupAction service = new TransactionRollbackSetupAction(serviceName);
phaseContext.getServiceTarget().addService(serviceName, service).addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, service.getTransactionManager()).install();
deploymentUnit.addToAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS, service);
}
use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.
the class SharedSessionManagerDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
SharedSessionManagerConfig sharedConfig = deploymentUnit.getAttachment(UndertowAttachments.SHARED_SESSION_MANAGER_CONFIG);
if (sharedConfig == null) {
return;
}
ServiceTarget target = phaseContext.getServiceTarget();
ServiceName deploymentServiceName = deploymentUnit.getServiceName();
ServiceName managerServiceName = deploymentServiceName.append(SharedSessionManagerConfig.SHARED_SESSION_MANAGER_SERVICE_NAME);
DistributableSessionManagerFactoryBuilder builder = new DistributableSessionManagerFactoryBuilderValue().getValue();
if (builder != null) {
CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
Module module = deploymentUnit.getAttachment(Attachments.MODULE);
builder.build(support, target, managerServiceName, new SimpleDistributableSessionManagerConfiguration(sharedConfig, deploymentUnit.getName(), module)).setInitialMode(Mode.ON_DEMAND).install();
} else {
InMemorySessionManager manager = new InMemorySessionManager(deploymentUnit.getName(), sharedConfig.getMaxActiveSessions());
if (sharedConfig.getSessionConfig() != null) {
if (sharedConfig.getSessionConfig().getSessionTimeoutSet()) {
manager.setDefaultSessionTimeout(sharedConfig.getSessionConfig().getSessionTimeout());
}
}
SessionManagerFactory factory = new ImmediateSessionManagerFactory(manager);
target.addService(managerServiceName, new ValueService<>(new ImmediateValue<>(factory))).setInitialMode(Mode.ON_DEMAND).install();
}
ServiceName codecServiceName = deploymentServiceName.append(SharedSessionManagerConfig.SHARED_SESSION_IDENTIFIER_CODEC_SERVICE_NAME);
DistributableSessionIdentifierCodecBuilder sessionIdentifierCodecBuilder = new DistributableSessionIdentifierCodecBuilderValue().getValue();
if (sessionIdentifierCodecBuilder != null) {
sessionIdentifierCodecBuilder.build(target, codecServiceName, deploymentUnit.getName()).setInitialMode(Mode.ON_DEMAND).install();
} else {
// Fallback to simple codec if server does not support clustering
SimpleSessionIdentifierCodecService.build(target, codecServiceName).setInitialMode(Mode.ON_DEMAND).install();
}
}
Aggregations