Search in sources :

Example 6 with PostInitLoader

use of com.arjuna.orbportability.internal.utils.PostInitLoader in project wildfly by wildfly.

the class ArjunaTransactionManagerService method start.

@Override
public synchronized void start(final StartContext context) throws StartException {
    final CoordinatorEnvironmentBean coordinatorEnvironmentBean = arjPropertyManager.getCoordinatorEnvironmentBean();
    coordinatorEnvironmentBean.setEnableStatistics(coordinatorEnableStatistics);
    coordinatorEnvironmentBean.setDefaultTimeout(coordinatorDefaultTimeout);
    coordinatorEnvironmentBean.setTransactionStatusManagerEnable(transactionStatusManagerEnable);
    TxControl.setDefaultTimeout(coordinatorDefaultTimeout);
    // Object Store Browser bean
    Map<String, String> objStoreBrowserTypes = new HashMap<String, String>();
    objStoreBrowser = new ObjStoreBrowser();
    objStoreBrowserTypes.put("StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction", "com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean");
    objStoreBrowserTypes.put("StateManager/AbstractRecord/ConnectableResourceRecord", "com.arjuna.ats.internal.jta.tools.osb.mbean.jta.ConnectableResourceRecordBean");
    if (!jts) {
        // No IIOP, stick with Jakarta Transactions mode.
        final com.arjuna.ats.jbossatx.jta.TransactionManagerService service = new com.arjuna.ats.jbossatx.jta.TransactionManagerService();
        final LocalUserTransaction userTransaction = LocalUserTransaction.getInstance();
        jtaEnvironmentBean.getValue().setUserTransaction(userTransaction);
        service.setJbossXATerminator(xaTerminatorInjector.getValue());
        service.setTransactionSynchronizationRegistry(new TransactionSynchronizationRegistryWrapper());
        try {
            service.create();
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.managerStartFailure(e, "Transaction");
        }
        service.start();
        value = service;
    } else {
        final ORB orb = orbInjector.getValue();
        new PostInitLoader(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"), orb);
        // IIOP is enabled, so fire up JTS mode.
        final com.arjuna.ats.jbossatx.jts.TransactionManagerService service = new com.arjuna.ats.jbossatx.jts.TransactionManagerService();
        final LocalUserTransaction userTransaction = LocalUserTransaction.getInstance();
        jtaEnvironmentBean.getValue().setUserTransaction(userTransaction);
        service.setJbossXATerminator(xaTerminatorInjector.getValue());
        service.setTransactionSynchronizationRegistry(new TransactionSynchronizationRegistryWrapper());
        service.setPropagateFullContext(true);
        // this is not great, but it's the only way presently to influence the behavior of com.arjuna.ats.internal.jbossatx.jts.InboundTransactionCurrentImple
        try {
            final Field field = TransactionManagerLocator.class.getDeclaredField("tm");
            field.setAccessible(true);
            field.set(TransactionManagerLocator.getInstance(), jtaEnvironmentBean.getValue().getTransactionManager());
        } catch (IllegalAccessException e) {
            throw new IllegalAccessError(e.getMessage());
        } catch (NoSuchFieldException e) {
            throw new NoSuchFieldError(e.getMessage());
        }
        objStoreBrowserTypes.put("StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple", "com.arjuna.ats.arjuna.tools.osb.mbean.ActionBean");
        try {
            service.create();
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.createFailed(e);
        }
        try {
            service.start(orb);
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.startFailure(e);
        }
        value = service;
    }
    try {
        objStoreBrowser.start();
    } catch (Exception e) {
        throw TransactionLogger.ROOT_LOGGER.objectStoreStartFailure(e);
    }
}
Also used : HashMap(java.util.HashMap) CoordinatorEnvironmentBean(com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean) ObjStoreBrowser(com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser) TransactionSynchronizationRegistryWrapper(org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper) PostInitLoader(com.arjuna.orbportability.internal.utils.PostInitLoader) StartException(org.jboss.msc.service.StartException) Field(java.lang.reflect.Field) LocalUserTransaction(org.wildfly.transaction.client.LocalUserTransaction) ORB(org.omg.CORBA.ORB)

Aggregations

PostInitLoader (com.arjuna.orbportability.internal.utils.PostInitLoader)6 PreInitLoader (com.arjuna.orbportability.internal.utils.PreInitLoader)3 StartException (org.jboss.msc.service.StartException)2 ORB (org.omg.CORBA.ORB)2 CoordinatorEnvironmentBean (com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean)1 RecoveryEnvironmentBean (com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean)1 ObjStoreBrowser (com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser)1 AtomicActionRecoveryModule (com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule)1 ExpiredTransactionStatusManagerScanner (com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner)1 CommitMarkableResourceRecordRecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule)1 SubordinateAtomicActionRecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule)1 JCAServerTransactionRecoveryModule (com.arjuna.ats.internal.jta.recovery.jts.JCAServerTransactionRecoveryModule)1 ExpiredContactScanner (com.arjuna.ats.internal.jts.recovery.contact.ExpiredContactScanner)1 ExpiredServerScanner (com.arjuna.ats.internal.jts.recovery.transactions.ExpiredServerScanner)1 ExpiredToplevelScanner (com.arjuna.ats.internal.jts.recovery.transactions.ExpiredToplevelScanner)1 ServerTransactionRecoveryModule (com.arjuna.ats.internal.jts.recovery.transactions.ServerTransactionRecoveryModule)1 TopLevelTransactionRecoveryModule (com.arjuna.ats.internal.jts.recovery.transactions.TopLevelTransactionRecoveryModule)1 TORecoveryModule (com.arjuna.ats.internal.txoj.recovery.TORecoveryModule)1 RecoveryManagerService (com.arjuna.ats.jbossatx.jta.RecoveryManagerService)1 Field (java.lang.reflect.Field)1