Search in sources :

Example 6 with JTAEnvironmentBean

use of com.arjuna.ats.jta.common.JTAEnvironmentBean in project wildfly by wildfly.

the class JTAEnvironmentBeanService method stop.

@Override
public void stop(StopContext context) {
    final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
    // reset the XA orphan filters
    jtaEnvironmentBean.setXaResourceOrphanFilterClassNames(null);
    // reset the recovery nodes
    jtaEnvironmentBean.setXaRecoveryNodes(null);
    // reset the record wrapper plugin
    jtaEnvironmentBean.setXAResourceRecordWrappingPlugin(null);
    jtaEnvironmentBean.setLastResourceOptimisationInterfaceClassName(null);
}
Also used : JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean)

Example 7 with JTAEnvironmentBean

use of com.arjuna.ats.jta.common.JTAEnvironmentBean in project narayana by jbosstm.

the class ServerImpl method initialise.

public void initialise(LookupProvider lookupProvider, String nodeName, int portOffset, String[] clusterBuddies, ClassLoader classLoaderForTransactionManager) throws CoreEnvironmentBeanException, IOException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    this.nodeName = nodeName;
    this.classLoaderForTransactionManager = classLoaderForTransactionManager;
    RecoveryEnvironmentBean recoveryEnvironmentBean = com.arjuna.ats.arjuna.common.recoveryPropertyManager.getRecoveryEnvironmentBean();
    recoveryEnvironmentBean.setRecoveryBackoffPeriod(1);
    recoveryEnvironmentBean.setRecoveryInetAddress(InetAddress.getByName("localhost"));
    recoveryEnvironmentBean.setRecoveryPort(4712 + portOffset);
    recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(InetAddress.getByName("localhost"));
    recoveryEnvironmentBean.setTransactionStatusManagerPort(4713 + portOffset);
    List<String> recoveryModuleClassNames = new ArrayList<String>();
    recoveryModuleClassNames.add("com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule");
    // recoveryModuleClassNames.add("com.arjuna.ats.internal.txoj.recovery.TORecoveryModule");
    recoveryModuleClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule");
    recoveryModuleClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule");
    recoveryEnvironmentBean.setRecoveryModuleClassNames(recoveryModuleClassNames);
    List<String> expiryScannerClassNames = new ArrayList<String>();
    expiryScannerClassNames.add("com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner");
    recoveryEnvironmentBean.setExpiryScannerClassNames(expiryScannerClassNames);
    recoveryEnvironmentBean.setRecoveryActivators(null);
    CoreEnvironmentBean coreEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoreEnvironmentBean();
    // coreEnvironmentBean.setSocketProcessIdPort(4714 + nodeName);
    coreEnvironmentBean.setNodeIdentifier(nodeName);
    // coreEnvironmentBean.setSocketProcessIdMaxPorts(1);
    coreEnvironmentBean.setProcessImplementationClassName(ManualProcessId.class.getName());
    coreEnvironmentBean.setPid(portOffset);
    CoordinatorEnvironmentBean coordinatorEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoordinatorEnvironmentBean();
    coordinatorEnvironmentBean.setEnableStatistics(false);
    coordinatorEnvironmentBean.setDefaultTimeout(300);
    coordinatorEnvironmentBean.setTransactionStatusManagerEnable(false);
    coordinatorEnvironmentBean.setDefaultTimeout(0);
    ObjectStoreEnvironmentBean actionStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, null);
    actionStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
    ObjectStoreEnvironmentBean stateStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "stateStore");
    stateStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
    ObjectStoreEnvironmentBean communicationStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "communicationStore");
    communicationStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/distributedjta-tests/tx-object-store/" + nodeName);
    JTAEnvironmentBean jTAEnvironmentBean = com.arjuna.ats.jta.common.jtaPropertyManager.getJTAEnvironmentBean();
    jTAEnvironmentBean.setLastResourceOptimisationInterface(org.jboss.tm.LastResource.class);
    jTAEnvironmentBean.setTransactionManagerClassName("com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate");
    jTAEnvironmentBean.setUserTransactionClassName("com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple");
    jTAEnvironmentBean.setTransactionSynchronizationRegistryClassName("com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple");
    List<String> xaRecoveryNodes = new ArrayList<String>();
    xaRecoveryNodes.add(nodeName);
    jTAEnvironmentBean.setXaRecoveryNodes(xaRecoveryNodes);
    List<String> xaResourceOrphanFilterClassNames = new ArrayList<String>();
    xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter");
    xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter");
    xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter");
    xaResourceOrphanFilterClassNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinationManagerXAResourceOrphanFilter");
    jTAEnvironmentBean.setXaResourceOrphanFilterClassNames(xaResourceOrphanFilterClassNames);
    jTAEnvironmentBean.setXAResourceRecordWrappingPlugin(new XAResourceRecordWrappingPluginImpl());
    recoveryManagerService = new RecoveryManagerService();
    recoveryManagerService.create();
    recoveryManagerService.addXAResourceRecovery(new TestResourceRecovery(nodeName));
    // This MUST be the last XAResourceRecovery class registered or you will
    // get unexpected recovery results, could add a specific interface for
    // this?
    recoveryManagerService.addXAResourceRecovery(new ProxyXAResourceRecovery(nodeName, clusterBuddies));
    recoveryManagerService.addSerializableXAResourceDeserializer(new ProxyXAResourceDeserializer());
    // recoveryManagerService.start();
    _recoveryManager = RecoveryManager.manager();
    RecoveryManager.manager().initialize();
    transactionManagerService = new TransactionManagerService();
    TxControl txControl = new com.arjuna.ats.arjuna.coordinator.TxControl();
    transactionManagerService.setJbossXATerminator(new com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator());
    transactionManagerService.setTransactionSynchronizationRegistry(new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple());
    transactionManagerService.create();
}
Also used : ArrayList(java.util.ArrayList) XAResourceRecordWrappingPluginImpl(com.arjuna.ats.internal.jbossatx.jta.XAResourceRecordWrappingPluginImpl) TransactionManagerService(com.arjuna.ats.jbossatx.jta.TransactionManagerService) JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean) ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) TestResourceRecovery(com.arjuna.ats.jta.distributed.TestResourceRecovery) CoreEnvironmentBean(com.arjuna.ats.arjuna.common.CoreEnvironmentBean) RecoveryManagerService(com.arjuna.ats.jbossatx.jta.RecoveryManagerService) CoordinatorEnvironmentBean(com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean) TxControl(com.arjuna.ats.arjuna.coordinator.TxControl) RecoveryEnvironmentBean(com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean) ManualProcessId(com.arjuna.ats.internal.arjuna.utils.ManualProcessId)

Example 8 with JTAEnvironmentBean

use of com.arjuna.ats.jta.common.JTAEnvironmentBean in project narayana by jbosstm.

the class OsgiServer method doStart.

public void doStart() throws Exception {
    Properties properties = PropertiesFactory.getDefaultProperties();
    if (configuration != null) {
        for (Enumeration<String> keyEnum = configuration.keys(); keyEnum.hasMoreElements(); ) {
            String key = keyEnum.nextElement();
            String val = configuration.get(key).toString();
            properties.put(key, val);
        }
    }
    OsgiTransactionManager transactionManager = new OsgiTransactionManager();
    JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
    jtaEnvironmentBean.setTransactionManager(transactionManager);
    jtaEnvironmentBean.setUserTransaction(transactionManager);
    RecoveryManagerService rmSvc = new RecoveryManagerService();
    rmSvc.create();
    recoveryManagerService = rmSvc;
    resourceRecoveryTracker = new ServiceTracker<>(bundleContext, XAResourceRecovery.class, this);
    TransactionManagerService tmSvc = new TransactionManagerService();
    tmSvc.setTransactionSynchronizationRegistry(jtaEnvironmentBean.getTransactionSynchronizationRegistry());
    tmSvc.create();
    transactionManagerService = tmSvc;
    ObjStoreBrowser osb = new ObjStoreBrowser();
    osb.setExposeAllRecordsAsMBeans(true);
    objStoreBrowserService = new ObjStoreBrowserImpl(osb);
    resourceRecoveryTracker.open();
    transactionManagerService.start();
    recoveryManagerService.start();
    objStoreBrowserService.start();
    register(TransactionManager.class, transactionManagerService.getTransactionManager());
    register(TransactionSynchronizationRegistry.class, transactionManagerService.getTransactionSynchronizationRegistry());
    register(UserTransaction.class, transactionManagerService.getUserTransaction());
    register(ObjStoreBrowserService.class, objStoreBrowserService);
    try {
        registrations.add(PlatformTransactionManagerImple.register(bundleContext, (OsgiTransactionManager) transactionManagerService.getTransactionManager()));
    } catch (Throwable t) {
    // Ignore, this is most certainly spring-tx which is not available
    }
}
Also used : RecoveryManagerService(com.arjuna.ats.jbossatx.jta.RecoveryManagerService) XAResourceRecovery(org.jboss.tm.XAResourceRecovery) ObjStoreBrowser(com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser) TransactionManagerService(com.arjuna.ats.jbossatx.jta.TransactionManagerService) JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean) Properties(java.util.Properties)

Example 9 with JTAEnvironmentBean

use of com.arjuna.ats.jta.common.JTAEnvironmentBean in project wildfly by wildfly.

the class CMResourceService method start.

@Override
public void start(StartContext context) throws StartException {
    final JTAEnvironmentBean jtaBean = jtaEnvironmentBean.getValue();
    synchronized (jtaBean) {
        List<String> connectableResourceJNDINames = jtaBean.getCommitMarkableResourceJNDINames();
        Map<String, String> connectableResourceTableNameMap = jtaBean.getCommitMarkableResourceTableNameMap();
        Map<String, Boolean> performImmediateCleanupOfConnectableResourceBranchesMap = jtaBean.getPerformImmediateCleanupOfCommitMarkableResourceBranchesMap();
        Map<String, Integer> connectableResourceRecordDeleteBatchSizeMap = jtaBean.getCommitMarkableResourceRecordDeleteBatchSizeMap();
        connectableResourceJNDINames.add(jndiName);
        connectableResourceTableNameMap.put(jndiName, tableName);
        performImmediateCleanupOfConnectableResourceBranchesMap.put(jndiName, immediateCleanup);
        connectableResourceRecordDeleteBatchSizeMap.put(jndiName, batchSize);
        jtaBean.setCommitMarkableResourceJNDINames(connectableResourceJNDINames);
        jtaBean.setCommitMarkableResourceTableNameMap(connectableResourceTableNameMap);
        jtaBean.setPerformImmediateCleanupOfCommitMarkableResourceBranchesMap(performImmediateCleanupOfConnectableResourceBranchesMap);
        jtaBean.setCommitMarkableResourceRecordDeleteBatchSizeMap(connectableResourceRecordDeleteBatchSizeMap);
    }
}
Also used : JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean)

Example 10 with JTAEnvironmentBean

use of com.arjuna.ats.jta.common.JTAEnvironmentBean in project wildfly by wildfly.

the class JTAEnvironmentBeanService method start.

@Override
public void start(StartContext context) throws StartException {
    final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
    jtaEnvironmentBean.setLastResourceOptimisationInterfaceClassName(LastResource.class.getName());
    // recovery nodes
    jtaEnvironmentBean.setXaRecoveryNodes(Collections.singletonList(nodeIdentifier));
    // setup the XA orphan filters
    if (useActionStatusServiceRecoveryFilter) {
        jtaEnvironmentBean.setXaResourceOrphanFilterClassNames(Arrays.asList(JTATransactionLogXAResourceOrphanFilter.class.getName(), JTANodeNameXAResourceOrphanFilter.class.getName(), SubordinateJTAXAResourceOrphanFilter.class.getName(), SubordinationManagerXAResourceOrphanFilter.class.getName(), JTAActionStatusServiceXAResourceOrphanFilter.class.getName()));
    } else {
        jtaEnvironmentBean.setXaResourceOrphanFilterClassNames(Arrays.asList(JTATransactionLogXAResourceOrphanFilter.class.getName(), JTANodeNameXAResourceOrphanFilter.class.getName(), SubordinateJTAXAResourceOrphanFilter.class.getName(), SubordinationManagerXAResourceOrphanFilter.class.getName()));
    }
    jtaEnvironmentBean.setXAResourceRecordWrappingPlugin(new com.arjuna.ats.internal.jbossatx.jta.XAResourceRecordWrappingPluginImpl());
    jtaEnvironmentBean.setTransactionManagerJNDIContext("java:jboss/TransactionManager");
    jtaEnvironmentBean.setTransactionSynchronizationRegistryJNDIContext("java:jboss/TransactionSynchronizationRegistry");
    jtaEnvironmentBean.setUserTransactionOperationsProviderClassName(LocalUserTransactionOperationsProvider.class.getName());
}
Also used : LocalUserTransactionOperationsProvider(org.jboss.as.txn.integration.LocalUserTransactionOperationsProvider) JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean) LastResource(org.jboss.tm.LastResource)

Aggregations

JTAEnvironmentBean (com.arjuna.ats.jta.common.JTAEnvironmentBean)10 XAResourceRecovery (org.jboss.tm.XAResourceRecovery)3 RecoveryEnvironmentBean (com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean)2 XATerminator (com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator)2 TransactionManagerImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple)2 TransactionSynchronizationRegistryImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)2 RecoveryManagerService (com.arjuna.ats.jbossatx.jta.RecoveryManagerService)2 TransactionManagerService (com.arjuna.ats.jbossatx.jta.TransactionManagerService)2 File (java.io.File)2 TransactionManager (javax.transaction.TransactionManager)2 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)2 XAResourceRecoveryRegistry (org.jboss.tm.XAResourceRecoveryRegistry)2 BeforeClass (org.junit.BeforeClass)2 ContextTransactionManager (org.wildfly.transaction.client.ContextTransactionManager)2 ContextTransactionSynchronizationRegistry (org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry)2 LocalTransactionContext (org.wildfly.transaction.client.LocalTransactionContext)2 JBossLocalTransactionProvider (org.wildfly.transaction.client.provider.jboss.JBossLocalTransactionProvider)2 CoordinatorEnvironmentBean (com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean)1 CoreEnvironmentBean (com.arjuna.ats.arjuna.common.CoreEnvironmentBean)1 ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)1