Package org.apache.qpid.server.txn
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()).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ServerTransaction.Action
Represents an action to be performed on transaction commit or rollbackstatic interface
ServerTransaction.EnqueueAction
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPostTransactionAction(ServerTransaction.Action postTransactionAction)
Register an Action for execution after transaction commit or rollback.void
commit()
Commit the transaction represented by this object.void
commit(Runnable immediatePostTransactionAction)
void
dequeue(Collection<MessageInstance> messages, ServerTransaction.Action postTransactionAction)
Dequeue a message(s) from queue(s) registering a post transaction action.void
dequeue(MessageEnqueueRecord record, ServerTransaction.Action postTransactionAction)
Dequeue a message from a queue registering a post transaction action.void
enqueue(Collection<? extends BaseQueue> queues, EnqueueableMessage message, ServerTransaction.EnqueueAction postTransactionAction)
Enqueue a message(s) to queue(s) registering a post transaction action.void
enqueue(TransactionLogResource queue, EnqueueableMessage message, ServerTransaction.EnqueueAction postTransactionAction)
Enqueue a message to a queue registering a post transaction action.long
getTransactionStartTime()
Return the time the current transaction started.long
getTransactionUpdateTime()
Return the time of the last activity on the current transaction.boolean
isTransactional()
void
rollback()
Rollback the transaction represented by this object.
-
-
-
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.
-
enqueue
void enqueue(TransactionLogResource queue, EnqueueableMessage message, ServerTransaction.EnqueueAction postTransactionAction)
Enqueue a message to a queue registering a post transaction action. A store operation will result only for a persistent message on a durable queue.
-
enqueue
void enqueue(Collection<? extends BaseQueue> queues, EnqueueableMessage message, ServerTransaction.EnqueueAction postTransactionAction)
Enqueue a message(s) to 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()
-
-