|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfabric.worker.transaction.TransactionManager
public final class TransactionManager
Holds transaction management information for a single thread. Each thread has its own TransactionManager.
We say that a transaction has acquired a write lock on an object if any entry
in the object's $history
list has $writeLockHolder
set to that transaction. @see fabric.lang.Object._Impl
We say that a transaction has acquired a read lock if it is in the "read list" for that object. @see fabric.lang.Object._Impl.$readMapEntry
When a transaction acquires a read lock, we ensure that the read condition holds: that the holder of the write lock is an ancestor of that transaction. Before reading an object, we ensure that the transaction holds a read lock and that the read condition still holds.
When a transaction acquires a write lock, we ensure that the write condition holds: the holders of the read and write locks are all ancestors of that transaction. Before writing an object, we ensure that the transaction holds a write lock and that the write condition still holds.
Assumptions:
The following objects are used as condition variables:
Method Summary | |
---|---|
void |
abortTransaction()
|
void |
associateAndSyncLog(Log log,
TransactionID tid)
Associates the given log with this worker's transaction manager and synchronizes the log with the given tid. |
void |
associateLog(Log log)
Associates the given transaction log with this transaction manager. |
boolean |
checkForStaleObjects()
Checks whether any of the objects used by a transaction are stale. |
void |
commitTransaction()
Commits the transaction if possible; otherwise, aborts the transaction. |
void |
commitTransaction(boolean useAuthentication)
Commits the transaction if possible; otherwise, aborts the transaction. |
void |
commitTransactionAt(long commitTime)
|
void |
deregisterThread(java.lang.Thread thread)
Registers that the given thread has finished. |
Log |
getCurrentLog()
|
TransactionID |
getCurrentTid()
|
RemoteWorker |
getFetchWorker(Object._Proxy proxy)
|
static TransactionManager |
getInstance()
|
static ReadMapEntry |
getReadMapEntry(Object._Impl impl,
long expiry)
|
SecurityCache |
getSecurityCache()
|
UpdateMap |
getUpdateMap()
|
void |
registerCreate(Object._Impl obj)
|
void |
registerRead(Object._Impl obj)
|
void |
registerRemoteCall(RemoteWorker worker)
Registers a remote call to the given worker. |
void |
registerThread(java.lang.Thread thread)
Registers the given thread with the current transaction. |
boolean |
registerWrite(Object._Impl obj)
This should be called before the object is modified. |
void |
sendCommitMessagesAndCleanUp()
Sends commit messages to the cohorts. |
void |
sendPrepareMessages(long commitTime)
Sends prepare messages to the cohorts. |
static void |
startThread(java.lang.Thread thread)
Starts the given thread, registering it as necessary. |
void |
startTransaction()
Starts a new transaction. |
void |
startTransaction(TransactionID tid)
Starts a new transaction with the given tid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ReadMapEntry getReadMapEntry(Object._Impl impl, long expiry)
public static TransactionManager getInstance()
public void abortTransaction()
public void commitTransaction() throws AbortException, TransactionRestartingException, TransactionAtomicityViolationException
AbortException
- if the transaction was aborted.
TransactionRestartingException
- if the transaction was aborted and needs to be retried.
TransactionAtomicityViolationException
public void commitTransaction(boolean useAuthentication) throws AbortException, TransactionRestartingException, TransactionAtomicityViolationException
useAuthentication
- whether to use an authenticated channel to talk to the store
AbortException
- if the transaction was aborted.
TransactionRestartingException
- if the transaction was aborted and needs to be retried.
TransactionAtomicityViolationException
public void commitTransactionAt(long commitTime) throws AbortException, TransactionRestartingException
AbortException
TransactionRestartingException
public void sendPrepareMessages(long commitTime)
public void sendCommitMessagesAndCleanUp() throws TransactionAtomicityViolationException
TransactionAtomicityViolationException
public void registerCreate(Object._Impl obj)
public void registerRead(Object._Impl obj)
public boolean registerWrite(Object._Impl obj)
public boolean checkForStaleObjects()
public void startTransaction()
public void startTransaction(TransactionID tid)
public static void startThread(java.lang.Thread thread)
public void registerThread(java.lang.Thread thread)
public void deregisterThread(java.lang.Thread thread)
public void registerRemoteCall(RemoteWorker worker)
public void associateLog(Log log)
public Log getCurrentLog()
public TransactionID getCurrentTid()
public UpdateMap getUpdateMap()
public RemoteWorker getFetchWorker(Object._Proxy proxy)
public SecurityCache getSecurityCache()
public void associateAndSyncLog(Log log, TransactionID tid)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |