org.multiverse.stms.alpha.programmatic
Class AlphaProgrammaticReferenceTranlocal<E>

java.lang.Object
  extended by org.multiverse.stms.alpha.AlphaTranlocal
      extended by org.multiverse.stms.alpha.programmatic.AlphaProgrammaticReferenceTranlocal<E>
Type Parameters:
E -
All Implemented Interfaces:
org.multiverse.api.commitlock.CommitLock, org.multiverse.api.Transaction, org.multiverse.MultiverseConstants

public final class AlphaProgrammaticReferenceTranlocal<E>
extends AlphaTranlocal
implements org.multiverse.api.Transaction

The AlphaTranlocal for the AlphaProgrammaticReference. It is responsible for storing the state of the AlphaProgrammaticReference.

The AlpaRefTranlocal also implements the Transaction interface because it can be used as a lockOwner. This is done as a performance optimization.


Field Summary
 E value
           
 
Fields inherited from class org.multiverse.stms.alpha.AlphaTranlocal
___origin, ___transactionalObject, ___writeVersion, OPENED_FOR_COMMUTE, OPENED_FOR_COMMUTE_AND_DIRTY, OPENED_FOR_WRITE, OPENED_FOR_WRITE_AND_DIRTY
 
Fields inherited from interface org.multiverse.MultiverseConstants
___SANITY_CHECKS_ENABLED
 
Constructor Summary
AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReference<E> owner)
           
AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReference<E> owner, E value)
           
AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReferenceTranlocal<E> origin)
           
 
Method Summary
 void abort()
           
 void commit()
           
 int getAttempt()
           
 org.multiverse.api.TransactionConfiguration getConfiguration()
           
 long getReadVersion()
           
 long getRemainingTimeoutNs()
           
 org.multiverse.api.TransactionStatus getStatus()
           
 boolean isDirty()
          Checks if this Tranlocal should be committed.
 AlphaTranlocal openForWrite()
          Returns a clone of this AlphaTranlocal to be used for updates.
 void prepare()
           
 void registerLifecycleListener(org.multiverse.api.lifecycle.TransactionLifecycleListener listener)
           
 void registerRetryLatch(org.multiverse.api.latches.Latch latch)
           
 void restart()
           
 void setAttempt(int attempt)
           
 void setRemainingTimeoutNs(long timeoutNs)
           
 AlphaTranlocalSnapshot takeSnapshot()
          Creates the TranlocalSnapshot of the Tranlocal.
 
Methods inherited from class org.multiverse.stms.alpha.AlphaTranlocal
___getLockOwner, ___releaseLock, ___tryLock, executeDirtyCheck, getOrigin, getPrecalculatedIsDirty, getTransactionalObject, getWriteVersion, hasReadConflict, hasWriteConflict, isCommitted, isCommuting, isUncommitted, lateFixation, prematureFixation, prepareForCommit, toDebugString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public E value
Constructor Detail

AlphaProgrammaticReferenceTranlocal

public AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReferenceTranlocal<E> origin)

AlphaProgrammaticReferenceTranlocal

public AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReference<E> owner)

AlphaProgrammaticReferenceTranlocal

public AlphaProgrammaticReferenceTranlocal(AlphaProgrammaticReference<E> owner,
                                           E value)
Method Detail

openForWrite

public AlphaTranlocal openForWrite()
Description copied from class: AlphaTranlocal
Returns a clone of this AlphaTranlocal to be used for updates. This method only should be called on tranlocals that have committed (so have a ___writeVersion larger than 0). The implementation is free to check for this violation, but it isn't mandatory.

Specified by:
openForWrite in class AlphaTranlocal
Returns:
the clone of this AlphaTranlocal that can be used for updates.

takeSnapshot

public AlphaTranlocalSnapshot takeSnapshot()
Description copied from class: AlphaTranlocal
Creates the TranlocalSnapshot of the Tranlocal. A snapshot should only be made if this Tranlocal is not committed.

Specified by:
takeSnapshot in class AlphaTranlocal
Returns:
the snapshot.

isDirty

public boolean isDirty()
Description copied from class: AlphaTranlocal
Checks if this Tranlocal should be committed.

Specified by:
isDirty in class AlphaTranlocal
Returns:
true if it should be committed, false otherwise.

abort

public void abort()
Specified by:
abort in interface org.multiverse.api.Transaction

getConfiguration

public org.multiverse.api.TransactionConfiguration getConfiguration()
Specified by:
getConfiguration in interface org.multiverse.api.Transaction

getReadVersion

public long getReadVersion()
Specified by:
getReadVersion in interface org.multiverse.api.Transaction

getStatus

public org.multiverse.api.TransactionStatus getStatus()
Specified by:
getStatus in interface org.multiverse.api.Transaction

commit

public void commit()
Specified by:
commit in interface org.multiverse.api.Transaction

prepare

public void prepare()
Specified by:
prepare in interface org.multiverse.api.Transaction

restart

public void restart()
Specified by:
restart in interface org.multiverse.api.Transaction

registerRetryLatch

public void registerRetryLatch(org.multiverse.api.latches.Latch latch)
Specified by:
registerRetryLatch in interface org.multiverse.api.Transaction

registerLifecycleListener

public void registerLifecycleListener(org.multiverse.api.lifecycle.TransactionLifecycleListener listener)
Specified by:
registerLifecycleListener in interface org.multiverse.api.Transaction

getRemainingTimeoutNs

public long getRemainingTimeoutNs()
Specified by:
getRemainingTimeoutNs in interface org.multiverse.api.Transaction

setRemainingTimeoutNs

public void setRemainingTimeoutNs(long timeoutNs)
Specified by:
setRemainingTimeoutNs in interface org.multiverse.api.Transaction

getAttempt

public int getAttempt()
Specified by:
getAttempt in interface org.multiverse.api.Transaction

setAttempt

public void setAttempt(int attempt)
Specified by:
setAttempt in interface org.multiverse.api.Transaction


Copyright © 2008-2010 Multiverse. All Rights Reserved.