Search in sources :

Example 1 with UuidProcessId

use of com.arjuna.ats.internal.arjuna.utils.UuidProcessId in project wildfly by wildfly.

the class CoreEnvironmentService method start.

@Override
public void start(StartContext context) throws StartException {
    // Global configuration.
    final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean();
    if (coreEnvironmentBean.getProcessImplementationClassName() == null) {
        UuidProcessId id = new UuidProcessId();
        coreEnvironmentBean.setProcessImplementation(id);
    }
    try {
        coreEnvironmentBean.setNodeIdentifier(nodeIdentifier);
    } catch (CoreEnvironmentBeanException e) {
        throw new StartException(e.getCause());
    }
    // Setup the socket process id if there is a binding
    SocketBinding binding = socketProcessBindingInjector.getOptionalValue();
    if (binding != null) {
        int port = binding.getPort();
        coreEnvironmentBean.setSocketProcessIdPort(port);
    }
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) CoreEnvironmentBeanException(com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException) CoreEnvironmentBean(com.arjuna.ats.arjuna.common.CoreEnvironmentBean) StartException(org.jboss.msc.service.StartException) UuidProcessId(com.arjuna.ats.internal.arjuna.utils.UuidProcessId)

Example 2 with UuidProcessId

use of com.arjuna.ats.internal.arjuna.utils.UuidProcessId 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();
}
Also used : CoreEnvironmentService(org.jboss.as.txn.service.CoreEnvironmentService) ServiceName(org.jboss.msc.service.ServiceName) Endpoint(org.jboss.remoting3.Endpoint) UuidProcessId(com.arjuna.ats.internal.arjuna.utils.UuidProcessId)

Aggregations

UuidProcessId (com.arjuna.ats.internal.arjuna.utils.UuidProcessId)2 CoreEnvironmentBean (com.arjuna.ats.arjuna.common.CoreEnvironmentBean)1 CoreEnvironmentBeanException (com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException)1 SocketBinding (org.jboss.as.network.SocketBinding)1 CoreEnvironmentService (org.jboss.as.txn.service.CoreEnvironmentService)1 ServiceName (org.jboss.msc.service.ServiceName)1 StartException (org.jboss.msc.service.StartException)1 Endpoint (org.jboss.remoting3.Endpoint)1