예제 #1
0
 public static Locker getWritableLocker__wrappee__base(
     Environment env,
     Transaction userTxn,
     boolean dbIsTransactional,
     boolean retainNonTxnLocks,
     TransactionConfig autoCommitConfig)
     throws DatabaseException {
   EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
   boolean envIsTransactional = envImpl.isTransactional();
   if (userTxn == null) {
     Transaction xaLocker = env.getThreadTransaction();
     if (xaLocker != null) {
       return DbInternal.getLocker(xaLocker);
     }
   }
   if (dbIsTransactional && userTxn == null) {
     if (autoCommitConfig == null) {
       autoCommitConfig = DbInternal.getDefaultTxnConfig(env);
     }
     return new AutoTxn(envImpl, autoCommitConfig);
   } else if (userTxn == null) {
     if (retainNonTxnLocks) {
       return new BasicLocker(envImpl);
     } else {
       return new ThreadLocker(envImpl);
     }
   } else {
     if (!envIsTransactional) {
       throw new DatabaseException(
           "A Transaction cannot be used because the"
               + " environment was opened"
               + " non-transactionally");
     }
     if (!dbIsTransactional) {
       throw new DatabaseException(
           "A Transaction cannot be used because the"
               + " database was opened"
               + " non-transactionally");
     }
     Locker locker = DbInternal.getLocker(userTxn);
     if (locker.isReadCommittedIsolation() && !retainNonTxnLocks) {
       return new ReadCommittedLocker(envImpl, locker);
     } else {
       return locker;
     }
   }
 }
예제 #2
0
 public static Locker getReadableLocker__wrappee__base(
     Environment env,
     Transaction userTxn,
     boolean dbIsTransactional,
     boolean retainNonTxnLocks,
     boolean readCommittedIsolation)
     throws DatabaseException {
   if (userTxn != null && !dbIsTransactional) {
     throw new DatabaseException(
         "A Transaction cannot be used because the"
             + " database was opened"
             + " non-transactionally");
   }
   Locker locker = null;
   if (userTxn != null) {
     locker = DbInternal.getLocker(userTxn);
     if (locker.isReadCommittedIsolation()) {
       readCommittedIsolation = true;
     }
   }
   return getReadableLocker(env, locker, retainNonTxnLocks, readCommittedIsolation);
 }
예제 #3
0
 public static Locker getReadableLocker__wrappee__base(
     Environment env,
     Database dbHandle,
     Locker locker,
     boolean retainNonTxnLocks,
     boolean readCommittedIsolation)
     throws DatabaseException {
   DatabaseImpl dbImpl = DbInternal.dbGetDatabaseImpl(dbHandle);
   if (!dbImpl.isTransactional() && locker != null && locker.isTransactional()) {
     throw new DatabaseException(
         "A Transaction cannot be used because the"
             + " database was opened"
             + " non-transactionally");
   }
   if (locker != null && !locker.isTransactional() && !retainNonTxnLocks) {
     locker = null;
   }
   if (locker != null && locker.isReadCommittedIsolation()) {
     readCommittedIsolation = true;
   }
   return getReadableLocker(env, locker, retainNonTxnLocks, readCommittedIsolation);
 }