use of org.jboss.as.txn.service.CoreEnvironmentService in project wildfly by wildfly.
the class TransactionSubsystemAdd method performCoreEnvironmentBootTime.
private void performCoreEnvironmentBootTime(OperationContext context, ModelNode coreEnvModel) throws OperationFailedException {
// Configure the core configuration.
final String nodeIdentifier = TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.resolveModelAttribute(context, coreEnvModel).asString();
TransactionLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", nodeIdentifier);
final CoreEnvironmentService coreEnvironmentService = new CoreEnvironmentService(nodeIdentifier);
String socketBindingName = null;
if (TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.resolveModelAttribute(context, coreEnvModel).asBoolean(false)) {
// Use the UUID based id
UuidProcessId id = new UuidProcessId();
coreEnvironmentService.setProcessImplementation(id);
} else {
// Use the socket process id
coreEnvironmentService.setProcessImplementationClassName(ProcessIdType.SOCKET.getClazz());
socketBindingName = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.resolveModelAttribute(context, coreEnvModel).asString();
int ports = TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS.resolveModelAttribute(context, coreEnvModel).asInt();
coreEnvironmentService.setSocketProcessIdMaxPorts(ports);
}
final ServiceBuilder<?> coreEnvBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT, coreEnvironmentService);
if (socketBindingName != null) {
// Add a dependency on the socket id binding
ServiceName bindingName = SocketBinding.JBOSS_BINDING_NAME.append(socketBindingName);
coreEnvBuilder.addDependency(bindingName, SocketBinding.class, coreEnvironmentService.getSocketProcessBindingInjector());
}
coreEnvBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
}
Aggregations