public interface TransactionContext extends DistributedPrimitive
A transaction context is a vehicle for grouping operations into a unit with the properties of atomicity, isolation, and durability. Transactions also provide the ability to maintain an application's invariants or integrity constraints, supporting the property of consistency. Together these properties are known as ACID.
A transaction context provides a boundary within which transactions are run. It also is a place where all modifications made within a transaction are cached until the point when the transaction commits or aborts. It thus ensures isolation of work happening with in the transaction boundary. Within a transaction context isolation level is REPEATABLE_READS i.e. only data that is committed can be read. The only uncommitted data that can be read is the data modified by the current transaction.
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts any changes made in this transaction context and discarding all locally cached updates.
|
void |
begin()
Starts a new transaction.
|
java.util.concurrent.CompletableFuture<CommitStatus> |
commit()
Commits a transaction that was previously started thereby making its changes permanent
and externally visible.
|
<K,V> TransactionalMap<K,V> |
getTransactionalMap(java.lang.String mapName,
Serializer serializer)
Returns a transactional map data structure with the specified name.
|
boolean |
isOpen()
Returns if this transaction context is open.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
TransactionId |
transactionId()
Returns the transaction identifier.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
TransactionId transactionId()
boolean isOpen()
void begin()
java.util.concurrent.CompletableFuture<CommitStatus> commit()
void abort()
<K,V> TransactionalMap<K,V> getTransactionalMap(java.lang.String mapName, Serializer serializer)
K
- key typeV
- value typemapName
- name of the transactional mapserializer
- serializer to use for encoding/decoding keys and values of the map