org.multiverse.stms
Class AbstractTransactionConfig

java.lang.Object
  extended by org.multiverse.stms.AbstractTransactionConfig
All Implemented Interfaces:
TransactionConfig

public class AbstractTransactionConfig
extends java.lang.Object
implements TransactionConfig

Contains the configuration for the AbstractTransaction.

One advantage of this class is that it is a lot easier to add additional fields without having to change all constructors. It also reduces the need for constructors with a lot of arguments.`

Author:
Peter Veentjer.

Field Summary
 boolean automaticReadTracking
           
 BackoffPolicy backoffPolicy
           
 PrimitiveClock clock
           
 java.lang.String familyName
           
 boolean interruptible
           
 int maxRetryCount
           
 boolean preventWriteSkew
           
 boolean readOnly
           
 
Constructor Summary
AbstractTransactionConfig()
          This method should be removed, only used for testing purposes.
AbstractTransactionConfig(PrimitiveClock clock, BackoffPolicy backoffPolicy, java.lang.String familyName, boolean readOnly, int maxRetryCount, boolean interruptible, boolean preventWriteSkew, boolean automaticReadTracking)
           
 
Method Summary
 boolean automaticReadTracking()
          Checks if this transaction does automaticReadTracking.
 BackoffPolicy getBackoffPolicy()
          Returns the BackoffPolicy used by the Stm when a transaction conflicts with another transaction.
 java.lang.String getFamilyName()
          Returns the family name of this Transaction.
 int getMaxRetryCount()
          Returns the maximum number of times this Transaction be retried before failing.
 boolean isInterruptible()
          Checks if the Transaction can be interrupted if it is blocking.
 boolean isReadonly()
          Checks if this Transaction is readonly.
 boolean preventWriteSkew()
          Checks if this Transaction should prent writeskew.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clock

public final PrimitiveClock clock

backoffPolicy

public final BackoffPolicy backoffPolicy

familyName

public final java.lang.String familyName

readOnly

public final boolean readOnly

maxRetryCount

public final int maxRetryCount

interruptible

public final boolean interruptible

preventWriteSkew

public final boolean preventWriteSkew

automaticReadTracking

public final boolean automaticReadTracking
Constructor Detail

AbstractTransactionConfig

public AbstractTransactionConfig()
This method should be removed, only used for testing purposes.


AbstractTransactionConfig

public AbstractTransactionConfig(PrimitiveClock clock,
                                 BackoffPolicy backoffPolicy,
                                 java.lang.String familyName,
                                 boolean readOnly,
                                 int maxRetryCount,
                                 boolean interruptible,
                                 boolean preventWriteSkew,
                                 boolean automaticReadTracking)
Method Detail

getFamilyName

public java.lang.String getFamilyName()
Description copied from interface: TransactionConfig
Returns the family name of this Transaction. Every transaction in principle should have a family name. This information can be used for debugging/logging purposes but also other techniques that rely to know something about similar types of transactions like profiling.

Specified by:
getFamilyName in interface TransactionConfig
Returns:
the familyName. The returned value can be null.

getMaxRetryCount

public int getMaxRetryCount()
Description copied from interface: TransactionConfig
Returns the maximum number of times this Transaction be retried before failing. The returned value will always be equal or larger than 0. If the value is set high and you are encountering a lot of TooManyRetryExceptions it could be that the objects are just not concurrent enough.

Specified by:
getMaxRetryCount in interface TransactionConfig
Returns:
the maxRetryCount.

isInterruptible

public boolean isInterruptible()
Description copied from interface: TransactionConfig
Checks if the Transaction can be interrupted if it is blocking.

Specified by:
isInterruptible in interface TransactionConfig
Returns:
true if the Transaction can be interrupted if it is blocking, false otherwise.

isReadonly

public boolean isReadonly()
Description copied from interface: TransactionConfig
Checks if this Transaction is readonly.

Specified by:
isReadonly in interface TransactionConfig
Returns:
true if readonly, false otherwise.

preventWriteSkew

public boolean preventWriteSkew()
Description copied from interface: TransactionConfig
Checks if this Transaction should prent writeskew. This is an isolation anomaly and could lead to an execution of transactions that doesn't match any sequential execution. Writeskew detection can be expensive because more checks needs to be done. It also leads to lower concurrency because certain executions of transactions are not allowed and are aborted and retried.

If the transaction is readonly, the value is undefined since a readonly transaction can't suffer from the writeskew problem.

Specified by:
preventWriteSkew in interface TransactionConfig
Returns:
true if the writeskew problem is prevented, false otherwise.

automaticReadTracking

public boolean automaticReadTracking()
Description copied from interface: TransactionConfig
Checks if this transaction does automaticReadTracking. Read tracking is needed for blocking transactions, but also for writeskew detection. Disadvantage of read tracking is that it is more expensive because the reads not to be registered on some datastructure so that they are tracked.

Specified by:
automaticReadTracking in interface TransactionConfig
Returns:
true if the transaction does automatic read tracking, false otherwise.

getBackoffPolicy

public BackoffPolicy getBackoffPolicy()
Description copied from interface: TransactionConfig
Returns the BackoffPolicy used by the Stm when a transaction conflicts with another transaction.

Specified by:
getBackoffPolicy in interface TransactionConfig
Returns:
the BackoffPolicy used.


Copyright © 2008-2010 Multiverse. All Rights Reserved.