org.multiverse.stms.alpha.transactions
Interface AlphaTransaction

All Superinterfaces:
org.multiverse.api.Transaction
All Known Implementing Classes:
AbstractAlphaTransaction, AbstractReadonlyAlphaTransaction, AbstractUpdateAlphaTransaction, ArrayReadonlyAlphaTransaction, ArrayUpdateAlphaTransaction, MapReadonlyAlphaTransaction, MapUpdateAlphaTransaction, MonoReadonlyAlphaTransaction, MonoUpdateAlphaTransaction, NonTrackingReadonlyAlphaTransaction

public interface AlphaTransaction
extends org.multiverse.api.Transaction

A Transaction interface tailored for the Alpha STM.

Since a AlphaTransaction is a Transaction, it isn't thread-safe.

Author:
Peter Veentjer.

Method Summary
 AlphaTranlocal openForCommutingWrite(AlphaTransactionalObject transactionalObject)
          Opens the transactional object for a commuting operation.
 AlphaTranlocal openForConstruction(AlphaTransactionalObject transactionalObject)
          Opens the transactional object for construction (and writing) purposes.
 AlphaTranlocal openForRead(AlphaTransactionalObject transactionalObject)
          Opens the transactional object for reading purposes.
 AlphaTranlocal openForWrite(AlphaTransactionalObject transactionalObject)
          Opens the transactional object for writing purposes.
 
Methods inherited from interface org.multiverse.api.Transaction
abort, commit, getAttempt, getConfiguration, getReadVersion, getRemainingTimeoutNs, getStatus, prepare, registerLifecycleListener, registerRetryLatch, restart, setAttempt, setRemainingTimeoutNs
 

Method Detail

openForRead

AlphaTranlocal openForRead(AlphaTransactionalObject transactionalObject)
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.

Parameters:
transactionalObject - the transactional object to getClassMetadata the tranlocal for.
Returns:
the opened tranlocal.
Throws:
org.multiverse.api.exceptions.ControlFlowError
IllegalThreadStateException - if the transaction isn't active.

openForWrite

AlphaTranlocal openForWrite(AlphaTransactionalObject transactionalObject)
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.

Parameters:
transactionalObject - the transactional object to getClassMetadata the tranlocal for.
Returns:
the opened tranlocal.
Throws:
NullPointerException - if transactional object is null.
org.multiverse.api.exceptions.ControlFlowError
IllegalThreadStateException - if the transaction isn't active.

openForCommutingWrite

AlphaTranlocal openForCommutingWrite(AlphaTransactionalObject transactionalObject)
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.

Parameters:
transactionalObject - the transactional object to open
Returns:
the opened tranlocal.
Throws:
NullPointerException - if transactional object is null.
org.multiverse.api.exceptions.ControlFlowError
IllegalThreadStateException - if the transaction isn't active.

openForConstruction

AlphaTranlocal openForConstruction(AlphaTransactionalObject transactionalObject)
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.

Parameters:
transactionalObject - the transactional object to open for construction
Returns:
the opened tranlocal.
Throws:
NullPointerException - if transactional object is null.
org.multiverse.api.exceptions.ControlFlowError
IllegalThreadStateException - if the transaction isn't active.


Copyright © 2008-2010 Multiverse. All Rights Reserved.