|
||||||||||
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
A Txn is one that's created by a call to Environment.txnBegin. This class must support multithreaded use.
Field Summary | |
static byte |
TXN_NOSYNC
|
static byte |
TXN_SYNC
|
static byte |
TXN_WRITE_NOSYNC
|
Fields inherited from class com.sleepycat.je.txn.Locker |
defaultNoWait, deleteInfo, dirtyReadDefault, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, lockTimeOutMillis, thread |
Constructor Summary | |
Txn()
Constructor for reading from log. |
|
Txn(EnvironmentImpl envImpl,
TransactionConfig config)
Create a transaction from Environment.txnBegin. |
Method Summary | |
long |
abort()
Abort this transaction. |
(package private) void |
addLock(Long nodeId,
Lock lock,
LockType type,
LockGrantType grantStatus,
MemoryBudget mb)
Add lock to the appropriate queue. |
void |
addLogInfo(long nodeId,
long lastLsn)
Called by the log 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. |
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. |
boolean |
getAbortKnownDeleted(long nodeId)
|
long |
getAbortLsn(long nodeId)
|
(package private) long |
getFirstActiveLsn()
|
(package private) int |
getInMemorySize()
|
(package private) long |
getLastLsn()
Access to last LSN. |
int |
getLogSize()
|
long |
getTransactionId()
|
boolean |
isHandleLockTransferrable()
|
boolean |
isSerializableIsolation()
Is serializable isolation. |
boolean |
isTransactional()
Is transactional. |
LockResult |
lock(long nodeId,
LockType lockType,
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,
MemoryBudget mb)
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,
MemoryBudget mb)
A lock is being demoted. |
Locker |
newInstance()
Asserts false and returns null since only ThreadLocker should be cloned. |
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. |
void |
readFromLog(ByteBuffer logBuffer)
Initialize this object from the data in itemBuf. |
void |
registerCursor(CursorImpl cursor)
Cursors operating under this transaction are added to the collection. |
(package private) void |
removeLock(long nodeId,
Lock lock)
Remove the lock from the set owned by this transaction. |
void |
setHandleLockOwner(boolean operationOK,
Database dbHandle,
boolean dbIsClosing)
Created transactions don't transfer locks until commit. |
(package private) void |
setOnlyAbortable()
Set the state of a transaction to ONLY_ABORTABLE. |
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, getId, getLockTimeout, getTxnStartMillis, getTxnTimeOut, getWaitingFor, isDirtyReadDefault, isTimedOut, 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
Constructor Detail |
public Txn(EnvironmentImpl envImpl, TransactionConfig config) throws DatabaseException
public Txn()
Method Detail |
protected long generateId(TxnManager txnManager)
generateId
in class Locker
long getLastLsn()
public LockResult lock(long nodeId, LockType lockType, DatabaseImpl database) throws DatabaseException
lock
in class Locker
DatabaseException
public long commit() throws DatabaseException
DatabaseException
public long commit(byte flushSyncBehavior) throws DatabaseException
DatabaseException
public long abort() throws DatabaseException
DatabaseException
public void addLogInfo(long nodeId, long lastLsn) throws DatabaseException
DatabaseException
long getFirstActiveLsn() throws DatabaseException
DatabaseException
public void markDeleteAtTxnEnd(DatabaseImpl dbImpl, boolean deleteAtCommit, MemoryBudget mb) throws DatabaseException
Locker
markDeleteAtTxnEnd
in class Locker
dbImpl
- 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, MemoryBudget mb) throws DatabaseException
addLock
in class Locker
DatabaseException
void removeLock(long nodeId, Lock lock) throws DatabaseException
removeLock
in class Locker
DatabaseException
void moveWriteToReadLock(long nodeId, Lock lock, MemoryBudget mb)
moveWriteToReadLock
in class Locker
public boolean createdNode(long nodeId) throws DatabaseException
createdNode
in class Locker
DatabaseException
public long getAbortLsn(long nodeId) throws DatabaseException
getAbortLsn
in class Locker
DatabaseException
public boolean getAbortKnownDeleted(long nodeId) throws DatabaseException
getAbortKnownDeleted
in class Locker
DatabaseException
public boolean isTransactional()
isTransactional
in class Locker
public boolean isSerializableIsolation()
isSerializableIsolation
in class Locker
public Locker newInstance() throws DatabaseException
newInstance
in class Locker
DatabaseException
public void operationEnd() throws DatabaseException
operationEnd
in class Locker
DatabaseException
public void operationEnd(boolean operationOK) throws DatabaseException
operationEnd
in class Locker
operationOK
- is whether the operation succeeded, since
that may impact ending behavior. (i.e for AutoTxn)
DatabaseException
public void setHandleLockOwner(boolean operationOK, Database dbHandle, boolean dbIsClosing) throws DatabaseException
setHandleLockOwner
in class Locker
DatabaseException
public void registerCursor(CursorImpl cursor) throws DatabaseException
registerCursor
in class Locker
DatabaseException
public void unRegisterCursor(CursorImpl cursor) throws DatabaseException
unRegisterCursor
in class Locker
DatabaseException
public boolean isHandleLockTransferrable()
isHandleLockTransferrable
in class Locker
public LockStats collectStats(LockStats stats) throws DatabaseException
collectStats
in class Locker
DatabaseException
void setOnlyAbortable()
setOnlyAbortable
in class Locker
protected void checkState(boolean calledByAbort) throws DatabaseException
checkState
in class Locker
DatabaseException
public int getLogSize()
getLogSize
in interface LogWritable
LogWritable.getLogSize()
public void writeToLog(ByteBuffer logBuffer)
LogWritable
writeToLog
in interface LogWritable
logBuffer
- is the destination bufferLogWritable.writeToLog(java.nio.ByteBuffer)
public void readFromLog(ByteBuffer logBuffer)
LogReadable
readFromLog
in interface LogReadable
It's ok for FindBugs to whine about id not being synchronized.
public void dumpLog(StringBuffer sb, boolean verbose)
LogReadable
dumpLog
in interface LogReadable
sb
- destination string bufferverbose
- if true, dump the full, verbose versionLogReadable.dumpLog(java.lang.StringBuffer, boolean)
public long getTransactionId()
getTransactionId
in interface LogReadable
LogReadable.getTransactionId()
public boolean logEntryIsTransactional()
logEntryIsTransactional
in interface LogReadable
LogReadable.logEntryIsTransactional()
int getInMemorySize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |