|
|||||||||
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,
MemoryBudget mb)
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. |
boolean |
getAbortKnownDeleted(long nodeId)
|
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. |
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. |
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 |
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, getId, getLockTimeout, getTxnStartMillis, getTxnTimeOut, getWaitingFor, isReadUncommittedDefault, 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
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
DatabaseException
public Txn()
Method Detail |
---|
protected long generateId(TxnManager txnManager)
generateId
in class Locker
long getLastLsn()
public void setPrepared(boolean prepared)
public void setSuspended(boolean suspended)
public boolean isSuspended()
public LockResult lock(long nodeId, LockType lockType, DatabaseImpl database) throws DatabaseException
lock
in class Locker
DatabaseException
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, 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
int getAccumulatedDelta()
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 boolean isReadCommittedIsolation()
isReadCommittedIsolation
in class Locker
public Txn getTxnLocker()
getTxnLocker
in class Locker
public Locker newNonTxnLocker() throws DatabaseException
newNonTxnLocker
in class Locker
DatabaseException
public void releaseNonTxnLocks() throws DatabaseException
releaseNonTxnLocks
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 ignore, 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
public void setOnlyAbortable()
setOnlyAbortable
in class Locker
public boolean getOnlyAbortable()
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, byte entryTypeVersion)
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 |