•
• A transaction timeout occurs. If a timeout period has been specified for a transaction and the transaction does not complete within this limit, the transaction is placed in the Retry Queue. If the transaction has entered the completion stage when the timeout expires, the timeout will be ignored by the VisiTransact Transaction Service. You can set the default timeout for the VisiTransact Transaction Service at the command line.
• A Resource is unavailable. A Resource that is involved in the transaction is temporarily not available due to a communication failure or because the Resource server is down. The transaction is placed in the Retry Queue until it completes.
• The VisiTransact Transaction Service recovers and decision records show transactions are incomplete. During recovery, the information is gathered from the transaction log about the transactions that were incomplete when the VisiTransact Transaction Service went down. If the decision records indicate that the transaction has not completed yet, they are placed in the Retry Queue for completion.By configuring this property and setting it to an integer value "n", you can change the number of retries.If n is set to a value less than or equal to 0, the transaction is retried for ever. This is the default behavior. If it is set to a value greater than 0, the transaction is put into the retry queue, and during each attempt the transaction service will try to run the transaction to completion. If it fails, the transaction is put into the retry queue no more than n number of times. Note that "n" includes the original attempt in the count. So if for example you do not want the transaction to be retried after a failure, you must set "n" to 1. If you do want the transaction to be retried only once after a failure, you must set "n" to 2.Checked behavior is enforced for VisiTransact-managed transactions involved with deferred synchronous requests: transactions are rolled back if there are pending replies when a commit() is issued. If the request handler of a transactional object makes a deferred synchronous request and replies before the deferred synchronous request returns, the transaction is marked for rollback.The example below shows the client code for checked behavior when you have a deferred synchronous request and the reply returns after commit() is invoked. Checked behavior is successful—the transaction is rolled back....
// get reference to the Current
...
// begin a transaction
current->begin();
// create a dynamic request
CORBA::Request_var bankRequest = bank->_request("withdraw");
CORBA::NVList_ptr arguments = bankRequest->arguments();
CORBA::Any_var amt = new CORBA::Any();
*amt<<= ((float)1000.00);
arguments->add_value("amount", amt, CORBA::ARG_IN);
...
//invoke deferred synchronous request
bankRequest->send_deferred();
//forget to get the response
// commit the txn
try
{
current->commit(0);
}
catch(CORBA::TRANSACTION_ROLLEDBACK& e)
{
cerr << "SUCCESS, commit check worked()" << endl;
}
...The example below shows the client code for checked behavior when you have a deferred synchronous request and the reply returns before commit() is invoked. Checked behavior is successful—the transaction is committed....
// case where request arrived before commit
current->begin();
cerr << " === Invoking a dii deferred sync request" << endl;
bankRequest->send_deferred();
try {
//wait for reply
bankRequest->get_response();
current->commit(0);
}
catch(CORBA::TRANSACTION_ROLLEDBACK& e)
{
cerr << "FAILURE, TRANSACTION_ROLLEDBACK not expected" << endl;
}
}
• HeuristicRollback - The commit operation on Resource reports that a heuristic decision was made and that all relevant updates have been rolled back.
• HeuristicCommit - The rollback operation on Resource reports that a heuristic decision was made and all relevant updates have been committed.
• HeuristicMixed - The Resource has committed some relevant updates, and rolled back others.
• HeuristicHazard - The Resource does not know the result of at least one relevant update (the disposition of all relevant updates is not known). For the updates that are known, either all have been committed or all have been rolled back.
• The heuristic decision may be consistent with the outcome. If this is the case, the transaction can be completed normally, and the Resource may “forget” about the transaction and the heuristic decision. The Terminator does not need to be informed of the heuristic decision since it was consistent with the outcome of the transaction.
• The heuristic decision may differ from the outcome. In this case, the Resource consults its record of the heuristic outcome (which it previously placed in the stable storage), and returns one of the heuristic outcome exceptions (HeuristicCommit, HeuristicRollback, HeuristicMixed or HeuristicHazard) when completion continues.A transaction originator can request to receive heuristic reporting by setting the report_heuristics parameter of the commit() method to true. Notice the following code sample shows the commit() method as commit(1) for C++.
• SubtransactionsUnavailable – This exception is raised if the client thread already has an associated transaction and the transaction service implementation does not support nested transactions.
• NotSubtransaction – This exception is raised if the current transaction is not a subtransaction.
• Inactive – This exception is raised in a few scenarios whereby no action is taken when the current context is not right for the command issued.
• NotPrepared – This exception is raised when a transaction is not prepared (for two-phase commit transactions only).
• NoTransaction – This exception is raised when there is no transaction associated with the client thread.
• Unavailable – This exception is raised when the application can't get hold of propagation context.
• SynchronizationUnavailable – This exception is raised if the system does not support synchronization.