Search in sources :

Example 31 with ObjectStoreEnvironmentBean

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

the class LockManager method initialise.

/*
     * Don't need to protect with a synchronization as this routine can only be
     * called from within other protected methods. Only called if multiple
     * object model is used.
     */
protected final boolean initialise() {
    if (txojLogger.logger.isTraceEnabled()) {
        txojLogger.logger.trace("LockManager::initialise()");
    }
    boolean result = false;
    if (systemKey == null) {
        systemKey = type();
        if (mutex != null) {
            mutex.lock();
            if (lockStore == null) {
                try {
                    if (lockStoreType.equals(BasicLockStore.class.getName())) {
                        lockStore = new BasicLockStore();
                    } else {
                        ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
                        objectStoreEnvironmentBean.setLocalOSRoot(systemKey);
                        lockStore = new BasicPersistentLockStore(objectStoreEnvironmentBean);
                    }
                } catch (final Exception ex) {
                    lockStore = null;
                }
            }
            mutex.unlock();
        }
    }
    result = (lockStore != null);
    return result;
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) BasicLockStore(com.arjuna.ats.internal.txoj.lockstore.BasicLockStore) BasicPersistentLockStore(com.arjuna.ats.internal.txoj.lockstore.BasicPersistentLockStore) IOException(java.io.IOException) LockStoreException(com.arjuna.ats.txoj.exceptions.LockStoreException)

Example 32 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean 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 33 with ObjectStoreEnvironmentBean

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

the class RawOptimisticHammerUnitTest method init.

private static synchronized void init() throws Exception {
    if (!_init) {
        StoreManager sm = new StoreManager(null, new TwoPhaseVolatileStore(new ObjectStoreEnvironmentBean()), null);
        _init = true;
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) TwoPhaseVolatileStore(com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore) StoreManager(com.arjuna.ats.arjuna.objectstore.StoreManager)

Example 34 with ObjectStoreEnvironmentBean

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

the class OptimisticUnitTest method init.

private static synchronized void init() throws Exception {
    if (!_init) {
        StoreManager sm = new StoreManager(null, new TwoPhaseVolatileStore(new ObjectStoreEnvironmentBean()), null);
        _init = true;
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) TwoPhaseVolatileStore(com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore) StoreManager(com.arjuna.ats.arjuna.objectstore.StoreManager)

Example 35 with ObjectStoreEnvironmentBean

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

the class TransactionLog method init.

private void init(String storeDir, String impleType) {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = arjPropertyManager.getObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setObjectStoreDir(storeDir);
    if (impleType != null) {
        try {
            Class c = Class.forName(impleType);
            recoveryStore = (RecoveryStore) c.newInstance();
        } catch (final Throwable ex) {
            ex.printStackTrace();
        }
    } else
        recoveryStore = StoreManager.getRecoveryStore();
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)

Aggregations

ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)35 Test (org.junit.Test)22 Uid (com.arjuna.ats.arjuna.common.Uid)17 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)17 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)17 TwoPhaseVolatileStore (com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)7 CacheStore (com.arjuna.ats.internal.arjuna.objectstore.CacheStore)5 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)4 HashedActionStore (com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore)4 NullActionStore (com.arjuna.ats.internal.arjuna.objectstore.NullActionStore)4 VolatileStore (com.arjuna.ats.internal.arjuna.objectstore.VolatileStore)4 IOException (java.io.IOException)4 ParticipantStore (com.arjuna.ats.arjuna.objectstore.ParticipantStore)3 ShadowingStore (com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore)3 FatalError (com.arjuna.ats.arjuna.exceptions.FatalError)2 StoreManager (com.arjuna.ats.arjuna.objectstore.StoreManager)2 ActionStore (com.arjuna.ats.internal.arjuna.objectstore.ActionStore)2 HashedStore (com.arjuna.ats.internal.arjuna.objectstore.HashedStore)2 CoordinatorEnvironmentBean (com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean)1 CoreEnvironmentBean (com.arjuna.ats.arjuna.common.CoreEnvironmentBean)1