org.multiverse.stms.alpha.transactions
Class AbstractAlphaTransaction<C extends AbstractAlphaTransactionConfiguration,S extends org.multiverse.stms.AbstractTransactionSnapshot>
java.lang.Object
org.multiverse.stms.AbstractTransaction<C,S>
org.multiverse.stms.alpha.transactions.AbstractAlphaTransaction<C,S>
- Type Parameters:
C - S -
- All Implemented Interfaces:
- org.multiverse.api.Transaction, org.multiverse.MultiverseConstants, AlphaTransaction
- Direct Known Subclasses:
- AbstractReadonlyAlphaTransaction, AbstractUpdateAlphaTransaction
public abstract class AbstractAlphaTransaction<C extends AbstractAlphaTransactionConfiguration,S extends org.multiverse.stms.AbstractTransactionSnapshot>
- extends org.multiverse.stms.AbstractTransaction<C,S>
- implements AlphaTransaction
An abstract AlphaTransaction that provides some basic pluming logic.
- Author:
- Peter Veentjer.
| Fields inherited from class org.multiverse.stms.AbstractTransaction |
config |
| Fields inherited from interface org.multiverse.MultiverseConstants |
___SANITY_CHECKS_ENABLED |
| Methods inherited from class org.multiverse.stms.AbstractTransaction |
abort, commit, doAbortActive, doAbortPrepared, doClear, doInit, doPrepare, endOr, endOrAndStartElse, getAttempt, getConfiguration, getReadVersion, getRemainingTimeoutNs, getSnapshot, getStatus, init, makeChangesPermanent, prepare, registerLifecycleListener, registerRetryLatch, restart, setAttempt, setRemainingTimeoutNs, startOr, storeSnapshot, takeSnapshot |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.multiverse.api.Transaction |
abort, commit, getAttempt, getConfiguration, getReadVersion, getRemainingTimeoutNs, getStatus, prepare, registerLifecycleListener, registerRetryLatch, restart, setAttempt, setRemainingTimeoutNs |
AbstractAlphaTransaction
public AbstractAlphaTransaction(C config)
load
protected final AlphaTranlocal load(AlphaTransactionalObject txObject)
openForCommutingWrite
public final AlphaTranlocal openForCommutingWrite(AlphaTransactionalObject transactionalObject)
- Description copied from interface:
AlphaTransaction
- Opens the transactional object for a commuting operation.
It depends on the transaction if this operations is supported.
If the transactional object has never been committed before, a UncommittedReadConflict
is thrown.
If the transactional object has been opened for read and is tracked, it will
be upgraded to an opened for write.
If the transactional object already was opened for write, that tranlocal
is returned and no commuting operations are possible for that tranlocal.
If the transactional object already was opened for construction, that tranlocal
is returned.
- Specified by:
openForCommutingWrite in interface AlphaTransaction
- Parameters:
transactionalObject - the transactional object to open
- Returns:
- the opened tranlocal.
doOpenForCommutingWrite
protected AlphaTranlocal doOpenForCommutingWrite(AlphaTransactionalObject txObject)
openForRead
public final AlphaTranlocal openForRead(AlphaTransactionalObject transactionalObject)
- Description copied from interface:
AlphaTransaction
- Opens the transactional object for reading purposes. It is not allowed to be used for writing purposes, because
it could be used by other transactions. If the transactional object already is opened for writing, that
tranlocal is returned.
If transactional object is null, the return value is null.
If a openForRead is done on a transactional object that never has been committed
before, a UncommittedReadConflict is thrown.
If the transactional object already is opened for write, that version is returned.
If the transactional object already was opened for a commuting operation, it is fixated
and returned and now can be used for direct writing purposes.
If the transactional object already was opened for construction, that tranlocal is returned.
- Specified by:
openForRead in interface AlphaTransaction
- Parameters:
transactionalObject - the transactional object to getClassMetadata the tranlocal for.
- Returns:
- the opened tranlocal.
doOpenForRead
protected AlphaTranlocal doOpenForRead(AlphaTransactionalObject txObject)
openForWrite
public final AlphaTranlocal openForWrite(AlphaTransactionalObject transactionalObject)
- Description copied from interface:
AlphaTransaction
- Opens the transactional object for writing purposes.
It depends on the transaction if this operations is supported.
If a openForWrite is done on a transactional object that never has been committed
before, a UncommittedReadConflict is thrown.
If the transactional object already was opened for read, it is now upgraded to an
open for write (if it was tracked).
If the transactional object was opened for write, it will be fixated that tranlocal
can now be used for writing purposes.
If the transactional object already was opened for construction, that tranlocal
is returned.
- Specified by:
openForWrite in interface AlphaTransaction
- Parameters:
transactionalObject - the transactional object to getClassMetadata the tranlocal for.
- Returns:
- the opened tranlocal.
doOpenForWrite
protected AlphaTranlocal doOpenForWrite(AlphaTransactionalObject txObject)
openForConstruction
public final AlphaTranlocal openForConstruction(AlphaTransactionalObject transactionalObject)
- Description copied from interface:
AlphaTransaction
- Opens the transactional object for construction (and writing) purposes.
It depends on the transaction if this operation is supported.
It is extremely important that this call is done only once for a
transactional objects (when it is constructed). There is no protection against
doing this multiple times, and when this happens it could overwrite already
committed changes when the transaction commits.
Normally this call only is made by instrumented code or by Multiverse provided
transactional structure.
- Specified by:
openForConstruction in interface AlphaTransaction
- Parameters:
transactionalObject - the transactional object to open for construction
- Returns:
- the opened tranlocal.
doOpenForConstruction
protected AlphaTranlocal doOpenForConstruction(AlphaTransactionalObject txObject)
doRegisterRetryLatch
protected final boolean doRegisterRetryLatch(org.multiverse.api.latches.Latch latch,
long wakeupVersion)
- Overrides:
doRegisterRetryLatch in class org.multiverse.stms.AbstractTransaction<C extends AbstractAlphaTransactionConfiguration,S extends org.multiverse.stms.AbstractTransactionSnapshot>
dodoRegisterRetryLatch
protected abstract boolean dodoRegisterRetryLatch(org.multiverse.api.latches.Latch latch,
long wakeupVersion)
Copyright © 2008-2010 Multiverse. All Rights Reserved.