org.multiverse.stms.alpha.programmatic
Class AlphaProgrammaticLongTranlocal

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

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

The AlphaTranlocal for the AlphaProgrammaticLong.

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
___SANITY_CHECKS_ENABLED
 
Constructor Summary
AlphaProgrammaticLongTranlocal(AlphaProgrammaticLong transactionalObject, boolean commuting)
           
AlphaProgrammaticLongTranlocal(AlphaProgrammaticLongTranlocal 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.
 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 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, 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

AlphaProgrammaticLongTranlocal

public AlphaProgrammaticLongTranlocal(AlphaProgrammaticLong transactionalObject,
                                      boolean commuting)

AlphaProgrammaticLongTranlocal

public AlphaProgrammaticLongTranlocal(AlphaProgrammaticLongTranlocal 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

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.