Search in sources :

Example 1 with BasicPersistentLockStore

use of com.arjuna.ats.internal.txoj.lockstore.BasicPersistentLockStore 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)

Aggregations

ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)1 BasicLockStore (com.arjuna.ats.internal.txoj.lockstore.BasicLockStore)1 BasicPersistentLockStore (com.arjuna.ats.internal.txoj.lockstore.BasicPersistentLockStore)1 LockStoreException (com.arjuna.ats.txoj.exceptions.LockStoreException)1 IOException (java.io.IOException)1