#include <it_bus/transaction_manager.h>
Inheritance diagram for IT_Bus::TransactionManager:
This interface is used to perform actions such as thread attachment/detachment, transaction expiry/timeout specification, transaction participant/notification enlistment etc.
As with the TransactionSystem interface, where appropiate calls made to a TransactionManager operate on the transaction associated with the calling thread.
Definition at line 31 of file transaction_manager.h.
Public Member Functions | |
virtual TransactionIdentifier * | detach_thread ()=0 |
Break the association between the calling thread and its current transaction. | |
virtual Boolean | attach_thread (TransactionIdentifier *tx_identifier)=0 |
Make an association between the calling thread and the transaction identified by the 'tx_identifier' parameter. | |
virtual String | get_transaction_type ()=0 |
Get the underlying transaction type. | |
virtual TransactionIdentifier * | get_tx_identifier ()=0 |
An identifier for the transaction associated with the calling thread. | |
virtual void | set_transaction_timeout (UInt seconds) IT_THROW_DECL((Exception))=0 |
Set the timeout within which transactions must be completed. | |
virtual UInt | get_transaction_timeout () IT_THROW_DECL((Exception))=0 |
Get the timeout within which transactions must be completed. | |
virtual Boolean | enlist (TransactionParticipant *tx_participant, Boolean is_durable)=0 |
Enlist a participant in the transaction associated with the current thread. | |
virtual Boolean | enlist_for_notification (TransactionNotificationHandler *completion_handler) IT_THROW_DECL((Exception))=0 |
Enlist a participant for notification events. | |
virtual Boolean | commit_transaction (Boolean report_heuristics) IT_THROW_DECL((Exception))=0 |
Marks the successful end of a transactional unit of work. | |
virtual void | rollback_transaction () IT_THROW_DECL((Exception))=0 |
Marks the unsuccessful end of a transaction unit of work. | |
virtual void | include_tx_identifier (TransactionIdentifierMap &tx_map)=0 |
Add the transaction identifier for this specific transaction system to the supplied identifier Map. | |
virtual Boolean | recreate_transaction (String &encoded_transaction_state)=0 |
Recreate a pre-existing transaction based on its encoded state. | |
virtual String | get_encoded_transaction_state ()=0 |
Obtain an encoded form of the transaction currently associated with the current thread. |
virtual Boolean IT_Bus::TransactionManager::attach_thread | ( | TransactionIdentifier * | tx_identifier | ) | [pure virtual] |
Make an association between the calling thread and the transaction identified by the 'tx_identifier' parameter.
This operation may be used to associate multiple threads with a newly created or pre-existing transaction.
tx_identifier | A transaction identifier that has been obtained by calling IT_Bus::TransactionManager::detach_thread() or IT_Bus::TransactionManager::get_tx_identifier() operations. |
virtual Boolean IT_Bus::TransactionManager::commit_transaction | ( | Boolean | report_heuristics | ) | [pure virtual] |
Marks the successful end of a transactional unit of work.
This operates on the transaction associated with the calling thread. Any enlisted transaction participants will be requested to commit. Any enlisted notification participants will be informed of the outcome of the commit action.
report_heuristics | If supported by the underlying transaction provider, specifies whether heuristic decisions should be reported during the commit protocol. |
virtual TransactionIdentifier* IT_Bus::TransactionManager::detach_thread | ( | ) | [pure virtual] |
Break the association between the calling thread and its current transaction.
This means that the transaction context will not be propagated on subsequent operation calls made by the calling thread.
Normal transaction processing such as termination may still proceed on other threads. To re-attach the calling thread to this transaction the attach_thread() operation should be used.
A transaction may be detached from one thread, and later attached to a different thread.
virtual Boolean IT_Bus::TransactionManager::enlist | ( | TransactionParticipant * | tx_participant, | |
Boolean | is_durable | |||
) | [pure virtual] |
Enlist a participant in the transaction associated with the current thread.
If there is no transactions associated with the current thread, then this participant will be enlisted as soon as a transaction is associated with this thread.
tx_participant | The participant to enlist. | |
is_durable | Indicates that the participant is durable. In a two phase commit protocol, a durable participant will be involved in both the prepare and commit phases. A value of 'false' for this parameter indicates that this participant is only interested in being involved in the prepare phase of a two phase commit protocol. |
virtual Boolean IT_Bus::TransactionManager::enlist_for_notification | ( | TransactionNotificationHandler * | completion_handler | ) | [pure virtual] |
Enlist a participant for notification events.
Whenever a transactional event occurs, registered handlers will receive the appropriate notification.
tx_participant | The participant to enlist. |
virtual String IT_Bus::TransactionManager::get_encoded_transaction_state | ( | ) | [pure virtual] |
Obtain an encoded form of the transaction currently associated with the current thread.
If there is no transaction associated with the current thread then an empty String is returned.
virtual UInt IT_Bus::TransactionManager::get_transaction_timeout | ( | ) | [pure virtual] |
Get the timeout within which transactions must be completed.
virtual String IT_Bus::TransactionManager::get_transaction_type | ( | ) | [pure virtual] |
Get the underlying transaction type.
virtual TransactionIdentifier* IT_Bus::TransactionManager::get_tx_identifier | ( | ) | [pure virtual] |
An identifier for the transaction associated with the calling thread.
This identifier may be used to create an affinity between another thread and this transaction instance. That is, more than one thread can be making calls in the context of the same transaction.
If there are multiple transaction systems active on this thread, then the returned Identifier will include details of those transactions as well.
virtual void IT_Bus::TransactionManager::include_tx_identifier | ( | TransactionIdentifierMap & | tx_map | ) | [pure virtual] |
Add the transaction identifier for this specific transaction system to the supplied identifier Map.
If an identifier for this transaction system is already present in this map, then do nothing.
TransactionIdentifierMap | A map of transaction Identifiers keyed by the appropiate transaction system identifier string. |
virtual Boolean IT_Bus::TransactionManager::recreate_transaction | ( | String & | encoded_transaction_state | ) | [pure virtual] |
Recreate a pre-existing transaction based on its encoded state.
If there isd already a transaction active on the current thread then this operation does nothing and returns 'false'.
If there is no transaction active on the current thread, then the thread is associated with the newly recreated transaction whoose state is encapsulated in the String input parameter.
String | The encoded transaction state |
virtual void IT_Bus::TransactionManager::rollback_transaction | ( | ) | [pure virtual] |
Marks the unsuccessful end of a transaction unit of work.
This operates on the transaction associated with the calling thread. This operation causes the entire transaction to be aborted, Any enlisted transaction participants will be instructed to rollback their state to a pre-transaction position. Any enlisted notification participants will be informed that the transaction has been aborted.
virtual void IT_Bus::TransactionManager::set_transaction_timeout | ( | UInt | seconds | ) | [pure virtual] |
Set the timeout within which transactions must be completed.
If the timeout expires, the transaction is automatically aborted. This operation should be called before a transaction is initiated.
UInt | The lifetime in seconds of a transaction. |