|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
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 |
---|
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()
void setTransactionIsolation(int nLevel)
nLevel
- one of the TRANSACTION_* isolation values
IllegalStateException
- if the transaction isolation
level cannot be changedint getConcurrency()
void setConcurrency(int nConcurrency)
nConcurrency
- one of the CONCUR_* mode values
IllegalStateException
- if the concurrency mode
cannot be changedboolean isValuesImmutable()
void setValuesImmutable(boolean fImmutable)
fImmutable
- true iff the values are known to be immutable
IllegalStateException
- if the setting cannot be changedint getTransactionTimeout()
void setTransactionTimeout(int cSeconds)
cSeconds
- transaction timeout value in seconds.
Value of zero means "no timeout".
IllegalStateException
- if the concurrency mode
cannot be changedTransactionMap.Validator getValidator()
void setValidator(TransactionMap.Validator validator)
validator
- the Validator to be added
IllegalStateException
- if the validator cannot be addedvoid begin()
IllegalStateException
- if this TransactionMap has been
already startedvoid prepare()
ConcurrentModificationException
- if the changes cannot be
prepared due to the concurrency limitations
IllegalStateException
- if this TransactionMap serves as a
base to a nested TransactionMap that has not yet been
committed or rolled backvoid commit()
ConcurrentModificationException
- if the changes cannot be
committed due to the concurrency limitations
IllegalStateException
- if this TransactionMap serves as a
base to a nested TransactionMap that has not yet been
committed or rolled backvoid rollback()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |