org.multiverse.api
Interface TransactionConfiguration

All Known Implementing Classes:
AbstractTransactionConfiguration

public interface TransactionConfiguration

Contains the transaction configuration used by a Transaction. In the beginning this was all placed in the Transaction, adding a lot of 'informational' methods to the transaction and therefor complicating its usage. So all the configurational properties of the transaction are contained in this structure.

Author:
Peter Veentjer.

Method Summary
 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 getMaxRetries()
          Returns the maximum number of times this Transaction be retried before failing.
 PropagationLevel getPropagationLevel()
          Returns the PropagationLevel.
 long getTimeoutNs()
          Returns the total timeout in nanoseconds.
 TraceLevel getTraceLevel()
          Returns the TraceLevel
 boolean isExplicitRetryAllowed()
          If an explicit retry (so a blocking transaction) is allowed.
 boolean isInterruptible()
          Checks if the Transaction can be interrupted if it is blocking.
 boolean isReadonly()
          Checks if this Transaction is readonly.
 boolean isReadTrackingEnabled()
          Checks if this transaction does automatic read tracking.
 boolean isWriteSkewAllowed()
          Checks if this Transaction allows writeskew.
 int maxReadSpinCount()
          Returns the maximum number of times the transaction is allowed to spin on a read to become readable (perhaps it is locked).
 

Method Detail

getPropagationLevel

PropagationLevel getPropagationLevel()
Returns the PropagationLevel.

Returns:
the PropagationLevel.

getTraceLevel

TraceLevel getTraceLevel()
Returns the TraceLevel

Returns:
the TraceLevel.

getBackoffPolicy

BackoffPolicy getBackoffPolicy()
Returns the BackoffPolicy used by the Stm when a transaction conflicts with another transaction.

Returns:
the BackoffPolicy used.
See Also:
TransactionFactoryBuilder.setBackoffPolicy(BackoffPolicy)

getFamilyName

java.lang.String getFamilyName()
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.

Returns:
the familyName. The returned value can be null.
See Also:
TransactionFactoryBuilder.setFamilyName(String)

getMaxRetries

int getMaxRetries()
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.

Returns:
the maxRetries.
See Also:
TransactionFactoryBuilder.setMaxRetries(int)

getTimeoutNs

long getTimeoutNs()
Returns the total timeout in nanoseconds. Long.MAX_VALUE indicates that there is no timeout.

Returns:
the total remaining timeout.
See Also:
TransactionFactoryBuilder.setTimeoutNs(long)

isExplicitRetryAllowed

boolean isExplicitRetryAllowed()
If an explicit retry (so a blocking transaction) is allowed. With this property one can prevent that a Transaction is able to block waiting for some change.

Returns:
true if explicit retry is allowed, false otherwise.
See Also:
TransactionFactoryBuilder.setExplicitRetryAllowed(boolean)

isInterruptible

boolean isInterruptible()
Checks if the Transaction can be interrupted if it is blocking.

Returns:
true if the Transaction can be interrupted if it is blocking, false otherwise.
See Also:
TransactionFactoryBuilder.setInterruptible(boolean)

isReadonly

boolean isReadonly()
Checks if this Transaction is readonly.

Returns:
true if readonly, false otherwise.
See Also:
TransactionFactoryBuilder.setReadonly(boolean)

isReadTrackingEnabled

boolean isReadTrackingEnabled()
Checks if this transaction does automatic read tracking. 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.

Returns:
true if the transaction does automatic read tracking, false otherwise.
See Also:
TransactionFactoryBuilder.setReadTrackingEnabled(boolean)

isWriteSkewAllowed

boolean isWriteSkewAllowed()
Checks if this Transaction allows 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.

Returns:
true if the writeskew problem is allowed, false otherwise.
See Also:
TransactionFactoryBuilder.setWriteSkewAllowed(boolean)

maxReadSpinCount

int maxReadSpinCount()
Returns the maximum number of times the transaction is allowed to spin on a read to become readable (perhaps it is locked).

Returns:
the maximum number of spins


Copyright © 2008-2010 Multiverse. All Rights Reserved.