org.multiverse.stms.alpha.programmatic
Class AlphaProgrammaticLongRefTranlocal

java.lang.Object
  extended by org.multiverse.stms.alpha.AlphaTranlocal
      extended by org.multiverse.stms.alpha.programmatic.AlphaProgrammaticLongRefTranlocal
All Implemented Interfaces:
org.multiverse.api.commitlock.CommitLock, org.multiverse.api.Transaction, org.multiverse.MultiverseConstants

public final class AlphaProgrammaticLongRefTranlocal
extends AlphaTranlocal
implements org.multiverse.api.Transaction

The AlphaTranlocal for the AlphaProgrammaticLongRef.

It also implement the transaction interface. This is an optimization needed for the atomic methods, to prevent creating an expensive transaction object.

Author:
Peter Veentjer

Field Summary
 long commutingIncrements
           
 long 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
___BUGSHAKER_ENABLED, ___TRACING_ENABLED
 
Constructor Summary
AlphaProgrammaticLongRefTranlocal(AlphaProgrammaticLongRef transactionalObject, boolean commuting)
           
AlphaProgrammaticLongRefTranlocal(AlphaProgrammaticLongRefTranlocal origin)
           
 
Method Summary
 void abort()
           
 void commit()
           
 int getAttempt()
           
 org.multiverse.api.TransactionConfiguration getConfiguration()
           
 long getReadVersion()
           
 long getRemainingTimeoutNs()
           
 org.multiverse.api.TransactionStatus getStatus()
           
 org.multiverse.api.Stm getStm()
           
 org.multiverse.api.TransactionFactory getTransactionFactory()
           
 boolean isDirty()
          Checks if this Tranlocal should be committed.
 void lateFixation(AlphaTransaction tx)
           
 AlphaTranlocal openForWrite()
          Returns a clone of this AlphaTranlocal to be used for updates.
 void prematureFixation(AlphaTransaction tx, AlphaTranlocal origin)
           
 void prepare()
           
 void registerLifecycleListener(org.multiverse.api.lifecycle.TransactionLifecycleListener listener)
           
 void registerRetryLatch(org.multiverse.api.latches.Latch latch)
           
 void reset()
           
 void setAttempt(int attempt)
           
 void setRemainingTimeoutNs(long timeoutNs)
           
 void start()
           
 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, prepareForCommit, toDebugString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public long value

commutingIncrements

public long commutingIncrements
Constructor Detail

AlphaProgrammaticLongRefTranlocal

public AlphaProgrammaticLongRefTranlocal(AlphaProgrammaticLongRef transactionalObject,
                                         boolean commuting)

AlphaProgrammaticLongRefTranlocal

public AlphaProgrammaticLongRefTranlocal(AlphaProgrammaticLongRefTranlocal origin)
Method Detail

prematureFixation

public void prematureFixation(AlphaTransaction tx,
                              AlphaTranlocal origin)
Overrides:
prematureFixation in class AlphaTranlocal

lateFixation

public void lateFixation(AlphaTransaction tx)
Overrides:
lateFixation in class AlphaTranlocal

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.

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.

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

reset

public void reset()
Specified by:
reset 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

start

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

getStm

public org.multiverse.api.Stm getStm()
Specified by:
getStm in interface org.multiverse.api.Transaction

getTransactionFactory

public org.multiverse.api.TransactionFactory getTransactionFactory()
Specified by:
getTransactionFactory 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.