Search in sources :

Example 1 with TwoPhaseVolatileStore

use of com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore in project narayana by jbosstm.

the class StateManager method setupStore.

/**
 * Make sure the object store is set up, if required.
 *
 * @param rootName
 *            indicates the root of the object store.
 */
@SuppressWarnings("unchecked")
protected synchronized void setupStore(String rootName, String objectStoreType) {
    if (tsLogger.logger.isTraceEnabled()) {
        tsLogger.logger.trace("StateManager::setupStore ( " + ((rootName != null) ? rootName : "null") + " )");
    }
    if (!loadObjectState())
        return;
    if (participantStore != null)
        return;
    if (rootName == null)
        rootName = arjPropertyManager.getObjectStoreEnvironmentBean().getLocalOSRoot();
    if (storeRoot != null) {
        if ((rootName == null) || (rootName.compareTo("") == 0) || (rootName.compareTo(storeRoot) == 0)) {
            return;
        }
        /* No - destroy old store and create new */
        participantStore = null;
    }
    if (rootName == null) {
        rootName = "";
    }
    /* Create store now */
    storeRoot = new String(rootName);
    if ((myType == ObjectType.ANDPERSISTENT) || (myType == ObjectType.NEITHER)) {
        int sharedStatus = ((objectModel == ObjectModel.SINGLE) ? StateType.OS_UNSHARED : StateType.OS_SHARED);
        participantStore = StoreManager.setupStore(rootName, sharedStatus);
    } else {
        try {
            participantStore = new TwoPhaseVolatileStore(new ObjectStoreEnvironmentBean());
        } catch (final Throwable ex) {
            tsLogger.i18NLogger.warn_StateManager_13();
            throw new FatalError(tsLogger.i18NLogger.get_StateManager_14());
        }
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) TwoPhaseVolatileStore(com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)

Example 2 with TwoPhaseVolatileStore

use of com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore in project narayana by jbosstm.

the class ObjectStoreTest method testTypedTwoPhaseVolatileStore.

@Test
public void testTypedTwoPhaseVolatileStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    objectStoreEnvironmentBean.setVolatileStoreSupportAllObjUids(true);
    typedVolatileStoreCommon(new TwoPhaseVolatileStore(objectStoreEnvironmentBean));
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) TwoPhaseVolatileStore(com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore) Test(org.junit.Test)

Example 3 with TwoPhaseVolatileStore

use of com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore 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 4 with TwoPhaseVolatileStore

use of com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore 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)

Aggregations

ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)4 TwoPhaseVolatileStore (com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)4 StoreManager (com.arjuna.ats.arjuna.objectstore.StoreManager)2 FatalError (com.arjuna.ats.arjuna.exceptions.FatalError)1 Test (org.junit.Test)1