Platform SDK: Transaction Server

setAbort Method

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

Declares that the transaction in which the object is executing must be aborted, and that the object should be deactivated on returning from the currently executing method call.

Provided By

Context class

void setAbort ( );

Remarks

The object is deactivated automatically on return from the method in which it called setAbort. If the object is the root of an automatic transaction, MTS aborts the transaction. If the object is transactional, but not the root of an automatic transaction, the transaction in which it's participating is doomed to abort. (An object is the root of a transaction if the MTS run-time environment has to initiate a new transaction for it. This is the case when the component that provides the object is configured to require a transaction and the object's creator doesn't have one, or when the component is configured to require a new transaction.)

You can call setAbort in error handlers to ensure that a transaction aborts when an error occurs. You can also call setAbort at the beginning of a method to protect your object from committing prematurely in the event of an unexpected return and then call setComplete just before the method returns, if all goes well.

See Also

Transactions, Context Objects, Deactivating Objects