Package org.multiverse.stms.gamma
Class GammaStmConfig
java.lang.Object
org.multiverse.stms.gamma.GammaStmConfig
Contains the default configuration for all transactions created by the GammaStm. With the TxnFactoryBuilder,
this behavior can be overridden.
Once the GammaStm has been created, changes on this structure are ignored because the content of this configuration
is copied.
-
Field Summary
FieldsModifier and TypeFieldDescriptionIf a transaction fails for a read/write conflict it should not hammer the system by trying again and running in the same conflict The default backoff policy helps to back threads of by sleeping/yielding.boolean
The default behavior if blocking transactions are allowed.boolean
If control flow errors should be reused.boolean
The default behavior for writing 'dirty' changes for an update transaction.boolean
The default behavior for blocking transactions if they are allowed to be interrupted.boolean
Should only be used internally to select fat instead of lean transactions.The default isolation level for all transactions executed by the GammaStm.int
The maximum size size of a fixed length transaction.int
The maximum size of a transaction that is allowed to do a full conflict scan instead of arrive/depart operations.int
The default number of retries a transaction is allowed to do if a transaction fails for a read/write conflict.int
The minimal size for the internal array for a variable length transaction.Contains the permanent TxnListeners that should always be executed.The default propagation level for all transactions executed by the Stm.int
The number of times a transactional object is only read before becoming readbiased.The default isolation level for all reads.boolean
The default readonly behavior.boolean
The GammaStm makes use of a speculative mechanism to select the optimal transaction settings/implementation for executing a transactional closure.int
The default number of spins a transaction is allowed for a read/write/commit if something is locked.long
The default timeout for a transaction if it blocks.With the trace level you have control if you get output of transactions executing.boolean
If reads should be tracked by the transaction (this is something else than (semi)visible reads).The default isolation level for all writes. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
permanentListeners
Contains the permanent TxnListeners that should always be executed. Null references are not allowed. -
propagationLevel
The default propagation level for all transactions executed by the Stm. -
isolationLevel
The default isolation level for all transactions executed by the GammaStm. -
readLockMode
The default isolation level for all reads. Putting this to a level higher than LockMode.None has the same effect as putting the isolationLevel to IsolationLevel.Serialized although the former approach will be pessimistic and the later be optimistic. -
writeLockMode
The default isolation level for all writes. For a write also a read is acquired, so the highest one wins. Putting it the LockMode.Write gives the same behavior as you have with Oracle. Reads are still allowed (even though a WriteLock is allowed) only other transactions are not able to acquire a lock on it (whatever the lock should be). -
blockingAllowed
public boolean blockingAllowedThe default behavior if blocking transactions are allowed. -
interruptible
public boolean interruptibleThe default behavior for blocking transactions if they are allowed to be interrupted. -
timeoutNs
public long timeoutNsThe default timeout for a transaction if it blocks. A Long.MAX_VALUE indicates that there is no timeout. -
readonly
public boolean readonlyThe default readonly behavior. Setting this to true would be quite useless. -
spinCount
public int spinCountThe default number of spins a transaction is allowed for a read/write/commit if something is locked. -
dirtyCheck
public boolean dirtyCheckThe default behavior for writing 'dirty' changes for an update transaction. If it is set to true, a change needs to be made. If there is no change, it will not be written (and essentially be seen as a read). -
minimalVariableLengthTransactionSize
public int minimalVariableLengthTransactionSizeThe minimal size for the internal array for a variable length transaction. A variable length transaction internally uses an array to store its content and when the transaction grows, the array will grow accordingly. -
trackReads
public boolean trackReadsIf reads should be tracked by the transaction (this is something else than (semi)visible reads). The advantage of readtracking is there is less overhead once it has been read, but the disadvantage is that the transaction needs to track more changes. -
maxRetries
public int maxRetriesThe default number of retries a transaction is allowed to do if a transaction fails for a read/write conflict. The GammaStm also uses a speculative configuration mechanism that can consume some, so setting it to a very low value in combination with speculativeConfigEnabled is not recommended. -
speculativeConfigEnabled
public boolean speculativeConfigEnabledThe GammaStm makes use of a speculative mechanism to select the optimal transaction settings/implementation for executing a transactional closure. An TxnExecutor will start cheap and grow to use more expensive transaction implementations (see the Lean/Fat transactions) and use the automatic retry mechanism of the STM to rescue itself from a situation where the speculation was incorrect. Setting it to false reduces the number of unwanted conflicts (once the TxnExecutor has learned it will not make the same mistakes again, so you only need to pay the price of speculation in the beginning) at the cost of overhead. -
maxFixedLengthTransactionSize
public int maxFixedLengthTransactionSizeThe maximum size size of a fixed length transaction. A fixed length transaction is very cheap compared to a variable length, but the big problem of the fixed length is that it needs to do a full transaction scan to see if the desired data is there. So there is a point where the full scan gets more expensive (O(N) vs O(log n)) expensive. Atm there has not been put much research in finding the optimal size and it could differ from machine to machine. It also is important that the fixed length transactions are able to put a frequently read ref in a hot spot, making the overhead of searching lower. -
backoffPolicy
If a transaction fails for a read/write conflict it should not hammer the system by trying again and running in the same conflict The default backoff policy helps to back threads of by sleeping/yielding. -
traceLevel
With the trace level you have control if you get output of transactions executing. It helps with debugging. If the org.multiverse.MultiverseConstants.___TracingEnabled is not set to true, this value is ignored and the whole profiling stuff is removed by the JIT since it effectively has become dead code. -
controlFlowErrorsReused
public boolean controlFlowErrorsReusedIf control flow errors should be reused. Normally exception reuse would be a very very very bad thing to do. But if they are used to regulate control flow, they can be thrown thousands of times a second and this puts a lot of pressure on the gc. The most expensive part is building the StackTrace. For more info about the control flow errors see the subclasses of theControlFlowError
like theReadWriteConflict
,RetryError
and theSpeculativeConfigurationError
. -
isFat
public boolean isFatShould only be used internally to select fat instead of lean transactions. Normally the speculative configuration takes care of this but for testing purposes you want to control it manually. -
maximumPoorMansConflictScanLength
public int maximumPoorMansConflictScanLengthThe maximum size of a transaction that is allowed to do a full conflict scan instead of arrive/depart operations. Arrive/depart is more expensive since it increased the pressure on refs that a full conflict scan for short transactions, but at a certain length of the transaction only needing to do a full conflict scan when the global conflict counter increases, becomes cheaper. -
readBiasedThreshold
public int readBiasedThresholdThe number of times a transactional object is only read before becoming readbiased. The advantage of a readBiased transactional object is that you don't need to arrive/depart (richmans conflict scan), but the disadvantage is that it could cause transactions to do full conflict scans even though they are not required.
-
-
Constructor Details
-
GammaStmConfig
public GammaStmConfig()
-
-
Method Details
-
validate
public void validate()Checks if the configuration is valid.- Throws:
IllegalStateException
- if the configuration isn't valid.
-