|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionMap
ConcurrentMap with additional transaction support.
TransactionMap is a thread safe map that could be used by transactions. It maintains two copies of the data: the base [committed] and local [uncommitted].
In all cases, "get" operation reads the local map first and, if not found, the base map second. The "put" and "remove" always use the local map (using a special mark to denote the removed resources). Additionally, depending on a concurrency mode and transaction isolation level the processing strategy for various operations differs.
CONCUR_PESSIMISTIC
TRANSACTION_GET_COMMITTED
TRANSACTION_REPEATABLE_GET
TRANSACTION_SERIALIZABLE
CONCUR_OPTIMISTIC
TRANSACTION_GET_COMMITTED
TRANSACTION_REPEATABLE_GET
TRANSACTION_SERIALIZABLE
CONCUR_EXTERNAL
This concurrency strategy is very similar to the optimistic one, except that no locking is performed during the "prepare" operation and all synchronization and validation are assumed to be done by a supplied Validator.
Nested Class Summary | |
---|---|
static interface |
TransactionMap.Validator A callback interface used by TransactionMap implementations. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry |
Field Summary | |
---|---|
static int |
CONCUR_EXTERNAL External concurrency. |
static int |
CONCUR_OPTIMISTIC Optimistic concurrency. |
static int |
CONCUR_PESSIMISTIC Pessimistic concurrency. |
static int |
TRANSACTION_GET_COMMITTED Dirty gets are prevented; non-repeatable gets and phantom gets can occur. |
static int |
TRANSACTION_REPEATABLE_GET Dirty gets and non-repeatable gets are prevented; phantom gets can occur. |
static int |
TRANSACTION_SERIALIZABLE Dirty gets, non-repeatable gets and phantom gets are prevented. |
Fields inherited from interface com.tangosol.util.ConcurrentMap |
---|
LOCK_ALL |
Method Summary | |
---|---|
void |
begin() Start a transaction for this TransactionMap. |
void |
commit() Commit the changes made to the TransactionMap. |
ConcurrentMap |
getBaseMap() Return the base map, which contains this TransactionMap's committed data. |
int |
getConcurrency() Retrieve this TransactionMap's current concurrency mode. |
int |
getTransactionIsolation() Retrieve this TransactionMap's current transaction isolation level. |
int |
getTransactionTimeout() Retrieve transaction timeout value for this TransactionMap. |
TransactionMap.Validator |
getValidator() Retrieve the topmost Validator in TransactionMap's validation chain. |
boolean |
isValuesImmutable() Check whether or not the values stored in this TransactionMap are known to be immutable. |
void |
prepare() Prepare to commit changes made to the TransactionMap. |
void |
rollback() Rollback the changes made to the TransactionMap. |
void |
setConcurrency(int nConcurrency) Attempt to change the concurrency mode to the given value. |
void |
setTransactionIsolation(int nLevel) Attempt to change the transaction isolation level to the specified value. |
void |
setTransactionTimeout(int cSeconds) Set transaction timeout value for this TransactionMap. |
void |
setValidator(TransactionMap.Validator validator) Add the specified Validator to the top of validation chain for this TransactionMap. |
void |
setValuesImmutable(boolean fImmutable) Specify whether or not the values stored in this TransactionMap are known to be immutable. |
Methods inherited from interface com.tangosol.util.ConcurrentMap |
---|
clear, containsKey, containsValue, get, isEmpty, lock, lock, put, putAll, remove, size, unlock |
Methods inherited from interface java.util.Map |
---|
entrySet, equals, hashCode, keySet, values |
Field Detail |
---|
static final int TRANSACTION_GET_COMMITTED
static final int TRANSACTION_REPEATABLE_GET
static final int TRANSACTION_SERIALIZABLE
static final int CONCUR_PESSIMISTIC
static final int CONCUR_OPTIMISTIC
static final int CONCUR_EXTERNAL
validate
call.
Method Detail |
---|
ConcurrentMap getBaseMap()
int getTransactionIsolation()
The TRANSACTION_* constants defined in this interface are the possible transaction isolation levels.
void setTransactionIsolation(int nLevel)
The TRANSACTION_* constants defined in this interface are the possible transaction isolation levels.
Note: This method cannot be called while in the middle of a transaction.
nLevel
- one of the TRANSACTION_* isolation valuesjava.lang.IllegalStateException
- if the transaction isolation level cannot be changedint getConcurrency()
The CONCUR_* constants defined in this interface are the possible concurrency mode values.
void setConcurrency(int nConcurrency)
The CONCUR_* constants defined in this interface are the possible concurrency mode values.
Note: This method cannot be called while in the middle of a transaction.
nConcurrency
- one of the CONCUR_* mode valuesjava.lang.IllegalStateException
- if the concurrency mode cannot be changedboolean isValuesImmutable()
void setValuesImmutable(boolean fImmutable)
If the values are not known to be immutable, TransactionMap must assume that they are mutable, and will clone the objects returned by the "get" method to ensure that any changes made to those values are rolled back if the transaction is rolled back.
By explicitly specifying that the values are known to be immutable, the TransactionMap is permitted to skip the cloning step, which may result in better performance.
Note: This method cannot be called while in the middle of a transaction.
fImmutable
- true iff the values are known to be immutablejava.lang.IllegalStateException
- if the setting cannot be changedint getTransactionTimeout()
void setTransactionTimeout(int cSeconds)
Note: This method cannot be called while in the middle of a transaction.
cSeconds
- transaction timeout value in seconds. Value of zero means "no timeout".java.lang.IllegalStateException
- if the concurrency mode cannot be changedTransactionMap.Validator getValidator()
void setValidator(TransactionMap.Validator validator)
Note: This method cannot be called while in the middle of a transaction.
validator
- the Validator to be addedjava.lang.IllegalStateException
- if the validator cannot be addedvoid begin()
Note: specifc implementations may choose to support the concept of an implicit begin of a transaction making this operation a no-op.
java.lang.IllegalStateException
- if this TransactionMap has been already startedvoid prepare()
java.util.ConcurrentModificationException
- if the changes cannot be prepared due to the concurrency limitationsjava.lang.IllegalStateException
- if this TransactionMap serves as a base to a nested TransactionMap that has not yet been committed or rolled backvoid commit()
java.util.ConcurrentModificationException
- if the changes cannot be committed due to the concurrency limitationsjava.lang.IllegalStateException
- if this TransactionMap serves as a base to a nested TransactionMap that has not yet been committed or rolled backvoid rollback()
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |