Interface TransactionContext

  • All Superinterfaces:
    DistributedPrimitive

    public interface TransactionContext
    extends DistributedPrimitive
    Provides a context for transactional operations.

    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.

    • Method Detail

      • transactionId

        TransactionId transactionId()
        Returns the transaction identifier.
        Returns:
        transaction id
      • isOpen

        boolean isOpen()
        Returns if this transaction context is open.
        Returns:
        true if open, false otherwise
      • begin

        void begin()
        Starts a new transaction.
      • commit

        CompletableFuture<CommitStatus> commit()
        Commits a transaction that was previously started thereby making its changes permanent and externally visible.
        Returns:
        A future that will be completed when the operation completes
      • abort

        void abort()
        Aborts any changes made in this transaction context and discarding all locally cached updates.
      • getTransactionalMap

        <K,​V> TransactionalMap<K,​V> getTransactionalMap​(String mapName,
                                                                    Serializer serializer)
        Returns a transactional map data structure with the specified name.
        Type Parameters:
        K - key type
        V - value type
        Parameters:
        mapName - name of the transactional map
        serializer - serializer to use for encoding/decoding keys and values of the map
        Returns:
        Transactional Map