www.it-ebooks.info
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Development of Tuxedo – Various APIs<br />
• It performs the rollback process if the application designates that the<br />
transaction is to be aborted<br />
• It performs a recovery procedure when failures occur<br />
Creating or in<strong>it</strong>iating a transaction<br />
There are mainly two ways to in<strong>it</strong>iate a transaction in a Tuxedo system: in<strong>it</strong>iated<br />
explic<strong>it</strong>ly by the application, or implic<strong>it</strong>ly by an administrator.<br />
• In your application code, you can use the tpbegin() function to in<strong>it</strong>iate your<br />
transaction. It creates the GTI and starts the transaction and communicates<br />
<strong>it</strong> to the TM. This function has two parameters: a transaction time-out value<br />
and a flag, which is currently undefined and must be set to 0. The application<br />
module that called tpbegin() should also call a termination-of-transaction<br />
function, tpcomm<strong>it</strong>() to comm<strong>it</strong>, or tpabort() to abort the transaction.<br />
• The Tuxedo system provides a built-in administrative configuration option<br />
called AUTOTRAN. The service that is marked w<strong>it</strong>h <strong>it</strong> in the UBBCONFIG file is part<br />
of a global transaction of <strong>it</strong>s caller. If <strong>it</strong> is not being called under a transaction,<br />
the Tuxedo system in<strong>it</strong>iates the transaction prior to invoking this service.<br />
Tuxedo's transactional functions<br />
The following is a list of Tuxedo's transactional functions along w<strong>it</strong>h their syntax:<br />
• tpbegin – int tpbegin(unsigned long timeout, long flags)<br />
• tpcomm<strong>it</strong> – int tpcomm<strong>it</strong>(long flags)<br />
• tpabort – int tpabort(long flags)<br />
• tpgetlev – int tpgetlev()<br />
• tpsuspend – int tpsuspend(TPTRANID *t_id,long flags)<br />
• tpresume – int tpresume(TPTRANID *t_id,long flags)<br />
• tpopen – int tpopen(void)<br />
• tpclose – int tpclose(void)<br />
[ 92 ]<br />
<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>