com.sleepycat.je.txn
Class LockerFactory

java.lang.Object
  extended by com.sleepycat.je.txn.LockerFactory

public class LockerFactory
extends Object

Factory of static methods for creating Locker objects.


Constructor Summary
LockerFactory()
           
 
Method Summary
static Locker getInternalReadOperationLocker(EnvironmentImpl envImpl)
          Get a non-transactional locker for internal database operations.
static Locker getReadableLocker(Environment env, Database dbHandle, Locker locker, boolean readCommittedIsolation)
          Get a locker for this database handle for a read or cursor operation.
static Locker getReadableLocker(Environment env, Transaction userTxn, boolean dbIsTransactional, boolean retainNonTxnLocks, boolean readCommittedIsolation)
          Get a locker for a read or cursor operation.
static Locker getWritableLocker(Environment env, Transaction userTxn, boolean dbIsTransactional, boolean autoTxnIsReplicated)
          Get a locker for a write operation, checking whether the db and environment is transactional or not.
static Locker getWritableLocker(Environment env, Transaction userTxn, boolean dbIsTransactional, boolean retainNonTxnLocks, boolean autoTxnIsReplicated, TransactionConfig autoCommitConfig)
          Get a locker for a write operation, also specifying whether to retain non-transactional locks when a new locker must be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockerFactory

public LockerFactory()
Method Detail

getWritableLocker

public static Locker getWritableLocker(Environment env,
                                       Transaction userTxn,
                                       boolean dbIsTransactional,
                                       boolean autoTxnIsReplicated)
                                throws DatabaseException
Get a locker for a write operation, checking whether the db and environment is transactional or not. Must return a non null locker.

Throws:
DatabaseException

getWritableLocker

public static Locker getWritableLocker(Environment env,
                                       Transaction userTxn,
                                       boolean dbIsTransactional,
                                       boolean retainNonTxnLocks,
                                       boolean autoTxnIsReplicated,
                                       TransactionConfig autoCommitConfig)
                                throws DatabaseException
Get a locker for a write operation, also specifying whether to retain non-transactional locks when a new locker must be created.

Parameters:
retainNonTxnLocks - is true for DbTree operations, so that the handle lock may be transferred out of the locker when the operation is complete.
autoTxnIsReplicated - is true if this transaction is executed on a rep group master, and needs to be broadcast. Currently, all application-created transactions are of the type com.sleepycat.je.txn.Txn, and are replicated if the parent environment is replicated. Auto Txns are trickier because they may be created for a local write operation, such as log cleaning.
Throws:
IllegalArgumentException - via db/cursor read/write methods.
DatabaseException

getReadableLocker

public static Locker getReadableLocker(Environment env,
                                       Transaction userTxn,
                                       boolean dbIsTransactional,
                                       boolean retainNonTxnLocks,
                                       boolean readCommittedIsolation)
                                throws DatabaseException
Get a locker for a read or cursor operation. See getWritableLocker for an explanation of retainNonTxnLocks.

Throws:
IllegalArgumentException - via db/cursor read/write methods.
DatabaseException

getReadableLocker

public static Locker getReadableLocker(Environment env,
                                       Database dbHandle,
                                       Locker locker,
                                       boolean readCommittedIsolation)
                                throws DatabaseException
Get a locker for this database handle for a read or cursor operation. In this case, retainNonTxnLocks is false. See getWritableLocker for an explanation of retainNonTxnLocks.

Throws:
IllegalArgumentException - via db/cursor read/write methods.
DatabaseException

getInternalReadOperationLocker

public static Locker getInternalReadOperationLocker(EnvironmentImpl envImpl)
Get a non-transactional locker for internal database operations. Always non replicated. This method is not called for user txns and should not throw a Java runtime exception (IllegalArgument, etc).



Copyright (c) 2004-2010 Oracle. All rights reserved.