Search in sources :

Example 1 with LocalTransactionContextService

use of org.jboss.as.txn.service.LocalTransactionContextService in project wildfly by wildfly.

the class TransactionSubsystemAdd method performRecoveryEnvBoottime.

private void performRecoveryEnvBoottime(OperationContext context, ModelNode model, final boolean jts, List<ServiceName> deps) throws OperationFailedException {
    //recovery environment
    final String recoveryBindingName = TransactionSubsystemRootResourceDefinition.BINDING.resolveModelAttribute(context, model).asString();
    final String recoveryStatusBindingName = TransactionSubsystemRootResourceDefinition.STATUS_BINDING.resolveModelAttribute(context, model).asString();
    final boolean recoveryListener = TransactionSubsystemRootResourceDefinition.RECOVERY_LISTENER.resolveModelAttribute(context, model).asBoolean();
    final ArjunaRecoveryManagerService recoveryManagerService = new ArjunaRecoveryManagerService(recoveryListener, jts);
    final ServiceBuilder<RecoveryManagerService> recoveryManagerServiceServiceBuilder = context.getServiceTarget().addService(TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER, recoveryManagerService);
    // add dependency on JTA environment bean
    recoveryManagerServiceServiceBuilder.addDependencies(deps);
    // Register WildFly transaction services - TODO: this should eventually be separated from the Narayana subsystem
    final LocalTransactionContextService localTransactionContextService = new LocalTransactionContextService();
    context.getServiceTarget().addService(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, localTransactionContextService).addDependency(TxnServices.JBOSS_TXN_EXTENDED_JBOSS_XA_TERMINATOR, ExtendedJBossXATerminator.class, localTransactionContextService.getExtendedJBossXATerminatorInjector()).addDependency(TxnServices.JBOSS_TXN_ARJUNA_TRANSACTION_MANAGER, com.arjuna.ats.jbossatx.jta.TransactionManagerService.class, localTransactionContextService.getTransactionManagerInjector()).addDependency(// no injection
    TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER).setInitialMode(Mode.ACTIVE).install();
    if (context.hasOptionalCapability("org.wildfly.remoting.endpoint", TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(), null)) {
        final RemotingTransactionServiceService remoteTransactionServiceService = new RemotingTransactionServiceService();
        context.getServiceTarget().addService(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE, remoteTransactionServiceService).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, remoteTransactionServiceService.getLocalTransactionContextInjector()).addDependency(RemotingServices.SUBSYSTEM_ENDPOINT, Endpoint.class, remoteTransactionServiceService.getEndpointInjector()).setInitialMode(Mode.ACTIVE).install();
    }
    if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(), null)) {
        final TransactionRemoteHTTPService remoteHTTPService = new TransactionRemoteHTTPService();
        context.getServiceTarget().addService(TxnServices.JBOSS_TXN_HTTP_REMOTE_TRANSACTION_SERVICE, remoteHTTPService).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, remoteHTTPService.getLocalTransactionContextInjectedValue()).addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, remoteHTTPService.getPathHandlerInjectedValue()).install();
    }
    final XATerminatorService xaTerminatorService;
    final ExtendedJBossXATerminatorService extendedJBossXATerminatorService;
    if (jts) {
        recoveryManagerServiceServiceBuilder.addDependency(ServiceName.JBOSS.append("iiop-openjdk", "orb-service"), ORB.class, recoveryManagerService.getOrbInjector());
        com.arjuna.ats.internal.jbossatx.jts.jca.XATerminator terminator = new com.arjuna.ats.internal.jbossatx.jts.jca.XATerminator();
        xaTerminatorService = new XATerminatorService(terminator);
        extendedJBossXATerminatorService = new ExtendedJBossXATerminatorService(terminator);
    } else {
        com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator terminator = new com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator();
        xaTerminatorService = new XATerminatorService(terminator);
        extendedJBossXATerminatorService = new ExtendedJBossXATerminatorService(terminator);
    }
    context.getServiceTarget().addService(TxnServices.JBOSS_TXN_XA_TERMINATOR, xaTerminatorService).setInitialMode(Mode.ACTIVE).install();
    context.getServiceTarget().addService(TxnServices.JBOSS_TXN_EXTENDED_JBOSS_XA_TERMINATOR, extendedJBossXATerminatorService).setInitialMode(Mode.ACTIVE).install();
    final JBossContextXATerminatorService contextXATerminatorService = new JBossContextXATerminatorService();
    context.getServiceTarget().addService(TxnServices.JBOSS_TXN_CONTEXT_XA_TERMINATOR, contextXATerminatorService).addDependency(TxnServices.JBOSS_TXN_XA_TERMINATOR, JBossXATerminator.class, contextXATerminatorService.getJBossXATerminatorInjector()).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, contextXATerminatorService.getLocalTransactionContextInjector()).setInitialMode(Mode.ACTIVE).install();
    recoveryManagerServiceServiceBuilder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(recoveryBindingName), SocketBinding.class, recoveryManagerService.getRecoveryBindingInjector()).addDependency(SocketBinding.JBOSS_BINDING_NAME.append(recoveryStatusBindingName), SocketBinding.class, recoveryManagerService.getStatusBindingInjector()).addDependency(SocketBindingManager.SOCKET_BINDING_MANAGER, SocketBindingManager.class, recoveryManagerService.getBindingManager()).addDependency(SuspendController.SERVICE_NAME, SuspendController.class, recoveryManagerService.getSuspendControllerInjector()).addDependency(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT).addDependency(TxnServices.JBOSS_TXN_ARJUNA_OBJECTSTORE_ENVIRONMENT).setInitialMode(ServiceController.Mode.ACTIVE).install();
}
Also used : JBossXATerminator(org.jboss.tm.JBossXATerminator) ExtendedJBossXATerminator(org.jboss.tm.ExtendedJBossXATerminator) SocketBinding(org.jboss.as.network.SocketBinding) JBossXATerminator(org.jboss.tm.JBossXATerminator) ExtendedJBossXATerminator(org.jboss.tm.ExtendedJBossXATerminator) ArjunaRecoveryManagerService(org.jboss.as.txn.service.ArjunaRecoveryManagerService) PathHandler(io.undertow.server.handlers.PathHandler) ArjunaTransactionManagerService(org.jboss.as.txn.service.ArjunaTransactionManagerService) TransactionManagerService(org.jboss.as.txn.service.TransactionManagerService) ExtendedJBossXATerminatorService(org.jboss.as.txn.service.ExtendedJBossXATerminatorService) TransactionRemoteHTTPService(org.jboss.as.txn.service.TransactionRemoteHTTPService) XATerminatorService(org.jboss.as.txn.service.XATerminatorService) ExtendedJBossXATerminatorService(org.jboss.as.txn.service.ExtendedJBossXATerminatorService) JBossContextXATerminatorService(org.jboss.as.txn.service.JBossContextXATerminatorService) RecoveryManagerService(com.arjuna.ats.jbossatx.jta.RecoveryManagerService) ArjunaRecoveryManagerService(org.jboss.as.txn.service.ArjunaRecoveryManagerService) LocalTransactionContext(org.wildfly.transaction.client.LocalTransactionContext) SocketBindingManager(org.jboss.as.network.SocketBindingManager) JBossContextXATerminatorService(org.jboss.as.txn.service.JBossContextXATerminatorService) LocalTransactionContextService(org.jboss.as.txn.service.LocalTransactionContextService) RemotingTransactionServiceService(org.jboss.as.txn.service.RemotingTransactionServiceService)

Aggregations

RecoveryManagerService (com.arjuna.ats.jbossatx.jta.RecoveryManagerService)1 PathHandler (io.undertow.server.handlers.PathHandler)1 SocketBinding (org.jboss.as.network.SocketBinding)1 SocketBindingManager (org.jboss.as.network.SocketBindingManager)1 ArjunaRecoveryManagerService (org.jboss.as.txn.service.ArjunaRecoveryManagerService)1 ArjunaTransactionManagerService (org.jboss.as.txn.service.ArjunaTransactionManagerService)1 ExtendedJBossXATerminatorService (org.jboss.as.txn.service.ExtendedJBossXATerminatorService)1 JBossContextXATerminatorService (org.jboss.as.txn.service.JBossContextXATerminatorService)1 LocalTransactionContextService (org.jboss.as.txn.service.LocalTransactionContextService)1 RemotingTransactionServiceService (org.jboss.as.txn.service.RemotingTransactionServiceService)1 TransactionManagerService (org.jboss.as.txn.service.TransactionManagerService)1 TransactionRemoteHTTPService (org.jboss.as.txn.service.TransactionRemoteHTTPService)1 XATerminatorService (org.jboss.as.txn.service.XATerminatorService)1 ExtendedJBossXATerminator (org.jboss.tm.ExtendedJBossXATerminator)1 JBossXATerminator (org.jboss.tm.JBossXATerminator)1 LocalTransactionContext (org.wildfly.transaction.client.LocalTransactionContext)1