|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sleepycat.je.txn.Locker
com.sleepycat.je.txn.Txn
public class Txn
A Txn is one that's created by a call to Environment.txnBegin. This class must support multithreaded use.
| Field Summary | |
|---|---|
static int |
ACCUMULATED_LIMIT
|
static byte |
TXN_NOSYNC
|
static byte |
TXN_SYNC
|
static byte |
TXN_WRITE_NOSYNC
|
| Fields inherited from class com.sleepycat.je.txn.Locker |
|---|
defaultNoWait, deleteInfo, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, lockTimeOutMillis, readUncommittedDefault, thread |
| Constructor Summary | |
|---|---|
Txn()
Constructor for reading from log. |
|
Txn(EnvironmentImpl envImpl,
TransactionConfig config)
Create a transaction from Environment.txnBegin. |
|
Txn(EnvironmentImpl envImpl,
TransactionConfig config,
long id)
|
|
| Method Summary | |
|---|---|
long |
abort(boolean forceFlush)
Abort this transaction. |
void |
abort(Xid xid)
|
(package private) void |
addLock(Long nodeId,
Lock lock,
LockType type,
LockGrantType grantStatus)
Add lock to the appropriate queue. |
void |
addLogInfo(long lastLsn)
Called by the recovery manager when logging a transaction aware object. |
protected void |
checkState(boolean calledByAbort)
Throw an exception if the transaction is not open. |
LockStats |
collectStats(LockStats stats)
stats |
long |
commit()
Call commit() with the default sync configuration property. |
long |
commit(byte flushSyncBehavior)
Commit this transaction 1. |
void |
commit(Xid xid)
|
boolean |
createdNode(long nodeId)
|
void |
dumpLog(StringBuffer sb,
boolean verbose)
Write the object into the string buffer for log dumping. |
protected long |
generateId(TxnManager txnManager)
UserTxns get a new unique id for each instance. |
long |
getAbortLsn(long nodeId)
|
(package private) int |
getAccumulatedDelta()
|
(package private) long |
getFirstActiveLsn()
|
(package private) int |
getInMemorySize()
|
(package private) long |
getLastLsn()
Access to last LSN. |
int |
getLogSize()
|
boolean |
getOnlyAbortable()
Get the state of a transaction's ONLY_ABORTABLE. |
long |
getTransactionId()
|
Txn |
getTxnLocker()
This is a transactional locker. |
WriteLockInfo |
getWriteLockInfo(long nodeId)
|
boolean |
isHandleLockTransferrable()
|
boolean |
isReadCommittedIsolation()
Is read-committed isolation if so configured. |
boolean |
isSerializableIsolation()
Is serializable isolation if so configured. |
boolean |
isSuspended()
|
boolean |
isTransactional()
Is always transactional. |
(package private) LockResult |
lockInternal(long nodeId,
LockType lockType,
boolean noWait,
DatabaseImpl database)
Gets a lock on this nodeId and, if it is a write lock, saves an abort LSN. |
boolean |
logEntryIsTransactional()
|
void |
markDeleteAtTxnEnd(DatabaseImpl dbImpl,
boolean deleteAtCommit)
Database operations like remove and truncate leave behind residual DatabaseImpls that must be purged at transaction commit or abort. |
(package private) void |
moveWriteToReadLock(long nodeId,
Lock lock)
A lock is being demoted. |
Locker |
newNonTxnLocker()
Returns 'this', since this locker holds no non-transactional locks. |
void |
operationEnd()
Created transactions do nothing at the end of the operation. |
void |
operationEnd(boolean operationOK)
Created transactions do nothing at the end of the operation. |
int |
prepare(Xid xid)
|
void |
readFromLog(ByteBuffer logBuffer,
byte entryTypeVersion)
Initialize this object from the data in itemBuf. |
void |
registerCursor(CursorImpl cursor)
Cursors operating under this transaction are added to the collection. |
void |
releaseNonTxnLocks()
This locker holds no non-transactional locks. |
(package private) void |
removeLock(long nodeId,
Lock lock)
Remove the lock from the set owned by this transaction. |
void |
setHandleLockOwner(boolean ignore,
Database dbHandle,
boolean dbIsClosing)
Created transactions don't transfer locks until commit. |
void |
setOnlyAbortable()
Set the state of a transaction to ONLY_ABORTABLE. |
void |
setPrepared(boolean prepared)
|
void |
setSuspended(boolean suspended)
|
void |
unRegisterCursor(CursorImpl cursor)
Remove a cursor from the collection. |
void |
writeToLog(ByteBuffer logBuffer)
Serialize this object into the buffer. |
| Methods inherited from class com.sleepycat.je.txn.Locker |
|---|
addDeleteInfo, addToHandleMaps, demoteLock, dumpLockTable, getDefaultNoWait, getId, getLockTimeout, getTxnStartMillis, getTxnTimeOut, getWaitingFor, isReadUncommittedDefault, isTimedOut, lock, nonBlockingLock, operationEnd, releaseLock, rememberHandleWriteLock, setLockTimeout, setTxnTimeout, setWaitingFor, sharesLocksWith, toString, transferHandleLock, transferHandleLockToHandle, unregisterHandle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte TXN_NOSYNC
public static final byte TXN_WRITE_NOSYNC
public static final byte TXN_SYNC
public static int ACCUMULATED_LIMIT
| Constructor Detail |
|---|
public Txn(EnvironmentImpl envImpl,
TransactionConfig config)
throws DatabaseException
DatabaseException
public Txn(EnvironmentImpl envImpl,
TransactionConfig config,
long id)
throws DatabaseException
DatabaseExceptionpublic Txn()
| Method Detail |
|---|
protected long generateId(TxnManager txnManager)
generateId in class Lockerlong getLastLsn()
public void setPrepared(boolean prepared)
public void setSuspended(boolean suspended)
public boolean isSuspended()
LockResult lockInternal(long nodeId,
LockType lockType,
boolean noWait,
DatabaseImpl database)
throws DatabaseException
lockInternal in class LockernodeId - is the node to lock.lockType - is the type of lock to request.noWait - is true to override the defaultNoWait setting. If true,
or if defaultNoWait is true, throws LockNotGrantedException if the lock
cannot be granted without waiting.database - is the database containing nodeId.
DeadlockException - if acquiring a blocking lock would result in a
deadlock.
DatabaseExceptionLocker.lockInternal(long, com.sleepycat.je.txn.LockType, boolean, com.sleepycat.je.dbi.DatabaseImpl)
public int prepare(Xid xid)
throws DatabaseException
DatabaseException
public void commit(Xid xid)
throws DatabaseException
DatabaseException
public void abort(Xid xid)
throws DatabaseException
DatabaseException
public long commit()
throws DatabaseException
DatabaseException
public long commit(byte flushSyncBehavior)
throws DatabaseException
DatabaseException
public long abort(boolean forceFlush)
throws DatabaseException
DatabaseException
public void addLogInfo(long lastLsn)
throws DatabaseException
DatabaseException
long getFirstActiveLsn()
throws DatabaseException
DatabaseException
public void markDeleteAtTxnEnd(DatabaseImpl dbImpl,
boolean deleteAtCommit)
throws DatabaseException
Locker
markDeleteAtTxnEnd in class LockerdbImpl - databaseImpl to removedeleteAtCommit - true if this databaseImpl should be cleaned on
commit, false if it should be cleaned on abort.mb - environment memory budget.
DatabaseException
void addLock(Long nodeId,
Lock lock,
LockType type,
LockGrantType grantStatus)
throws DatabaseException
addLock in class LockerDatabaseException
void removeLock(long nodeId,
Lock lock)
throws DatabaseException
removeLock in class LockerDatabaseException
void moveWriteToReadLock(long nodeId,
Lock lock)
moveWriteToReadLock in class Lockerint getAccumulatedDelta()
public boolean createdNode(long nodeId)
throws DatabaseException
createdNode in class LockerDatabaseException
public long getAbortLsn(long nodeId)
throws DatabaseException
getAbortLsn in class LockerDatabaseException
public WriteLockInfo getWriteLockInfo(long nodeId)
throws DatabaseException
getWriteLockInfo in class LockerDatabaseExceptionpublic boolean isTransactional()
isTransactional in class Lockerpublic boolean isSerializableIsolation()
isSerializableIsolation in class Lockerpublic boolean isReadCommittedIsolation()
isReadCommittedIsolation in class Lockerpublic Txn getTxnLocker()
getTxnLocker in class Locker
public Locker newNonTxnLocker()
throws DatabaseException
newNonTxnLocker in class LockerDatabaseException
public void releaseNonTxnLocks()
throws DatabaseException
releaseNonTxnLocks in class LockerDatabaseException
public void operationEnd()
throws DatabaseException
operationEnd in class LockerDatabaseException
public void operationEnd(boolean operationOK)
throws DatabaseException
operationEnd in class LockeroperationOK - is whether the operation succeeded, since
that may impact ending behavior. (i.e for AutoTxn)
DatabaseException
public void setHandleLockOwner(boolean ignore,
Database dbHandle,
boolean dbIsClosing)
throws DatabaseException
setHandleLockOwner in class LockerDatabaseException
public void registerCursor(CursorImpl cursor)
throws DatabaseException
registerCursor in class LockerDatabaseException
public void unRegisterCursor(CursorImpl cursor)
throws DatabaseException
unRegisterCursor in class LockerDatabaseExceptionpublic boolean isHandleLockTransferrable()
isHandleLockTransferrable in class Locker
public LockStats collectStats(LockStats stats)
throws DatabaseException
collectStats in class LockerDatabaseExceptionpublic void setOnlyAbortable()
setOnlyAbortable in class Lockerpublic boolean getOnlyAbortable()
protected void checkState(boolean calledByAbort)
throws DatabaseException
checkState in class LockerDatabaseExceptionpublic int getLogSize()
getLogSize in interface LogWritableLogWritable.getLogSize()public void writeToLog(ByteBuffer logBuffer)
LogWritable
writeToLog in interface LogWritablelogBuffer - is the destination bufferLogWritable.writeToLog(java.nio.ByteBuffer)
public void readFromLog(ByteBuffer logBuffer,
byte entryTypeVersion)
LogReadable
readFromLog in interface LogReadableIt's ok for FindBugs to whine about id not being synchronized.
public void dumpLog(StringBuffer sb,
boolean verbose)
LogReadable
dumpLog in interface LogReadablesb - destination string bufferverbose - if true, dump the full, verbose versionLogReadable.dumpLog(java.lang.StringBuffer, boolean)public long getTransactionId()
getTransactionId in interface LogReadableLogReadable.getTransactionId()public boolean logEntryIsTransactional()
logEntryIsTransactional in interface LogReadableLogReadable.logEntryIsTransactional()int getInMemorySize()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||