Interface ServerTransaction

  • All Known Implementing Classes:
    AsyncAutoCommitTransaction, AutoCommitTransaction, DistributedTransaction, LocalTransaction

    public interface ServerTransaction
    The ServerTransaction interface allows a set enqueue/dequeue operations to be performed against the transaction belonging the underlying TransactionLog object. Typically all ServerTransaction implementations decide if a message should be enlisted into a store transaction by examining the durable property of the queue, and the persistence property of the message. A caller may register a list of post transaction Actions to be performed on commit() (or rollback()).
    • Method Detail

      • getTransactionStartTime

        long getTransactionStartTime()
        Return the time the current transaction started.
        Returns:
        the time this transaction started or 0 if not in a transaction
      • getTransactionUpdateTime

        long getTransactionUpdateTime()
        Return the time of the last activity on the current transaction.
        Returns:
        the time of the last activity or 0 if not in a transaction
      • addPostTransactionAction

        void addPostTransactionAction​(ServerTransaction.Action postTransactionAction)
        Register an Action for execution after transaction commit or rollback. Actions will be executed in the order in which they are registered.
      • dequeue

        void dequeue​(MessageEnqueueRecord record,
                     ServerTransaction.Action postTransactionAction)
        Dequeue a message from a queue registering a post transaction action. A store operation will result only for a if the record is not null.
      • dequeue

        void dequeue​(Collection<MessageInstance> messages,
                     ServerTransaction.Action postTransactionAction)
        Dequeue a message(s) from queue(s) registering a post transaction action. Store operations will result only for a persistent messages on durable queues.
      • commit

        void commit()
        Commit the transaction represented by this object. If the caller has registered one or more Actions, the postCommit() method on each will be executed immediately after the underlying transaction has committed.
      • commit

        void commit​(Runnable immediatePostTransactionAction)
      • rollback

        void rollback()
        Rollback the transaction represented by this object. If the caller has registered one or more Actions, the onRollback() method on each will be executed immediately after the underlying transaction has rolled-back.
      • isTransactional

        boolean isTransactional()