Distributed transaction processing
◆ tpabort()
native void org.endurox.AtmiCtx.tpabort |
( |
long |
flags | ) |
|
Abort the global transaction. This will make any resources touched during the transaction to roll back. Enduro/X will make all resource managers to rollback the changes. Abort of transaction can only be done by transaction initiator, who originally did tpbegin().
- Parameters
-
flags | is reserved for future use and must be 0. |
- Exceptions
-
AtmiTPEINVALException | flags was not 0. |
AtmiTPETIMEException | Transaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown. |
AtmiTPEHAZARDException | The state of transaction is not fully know. It can be that it is partially committed and partially aborted. |
AtmiTPEHEURISTICException | The state of transaction is not full known. The transaction heuristically completed. |
AtmiTPESVCERRException | Failed to call transaction manager, with service error. The state of transaction is unknown. |
AtmiTPEPROTOException | XA subsystem was not initialized (did not call tpopen()), no global transaction started or caller is not initiator of transaction. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpbegin()
native void org.endurox.AtmiCtx.tpbegin |
( |
long |
timeout, |
|
|
long |
flags |
|
) |
| |
Begin the global transaction. The current user must be open XA subsystem by topopen(). timeout is setting for transaction manager (tmsrv) how long transaction can hang in active state (i.e. not prepared/committed). The work done by tpbegin() transaction is only in scope of processes which uses XA interfaces for resource managers. Any others works are outside of current scope. If timeout is set to 0, then default maximum time for transaction processing is used. Transaction must be committed or aborted by client process by using tpcommit() or tpabort(). If any tpcall() with no TPNOTRAN flag fails within given global transaction, then transaction is automatically marked as abort only. See tpopen(3) manpage for more information.
- Parameters
-
timeout | Number of seconds for which transaction can spend in active state. If time is overreached, transaction is aborted by tmsrv(8). |
flags. | Reserved for future use. Currently must be set to 0. |
- Exceptions
-
AtmiTPEINVALException | flags was not 0. |
AtmiTPETIMEException | Transaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown. |
AtmiTPESVCERRException | Failed to call transaction manager, with service error. The state of transaction is unknown. |
AtmiTPEPROTOException | XA subsystem was not initialized (did not call tpopen()) or global transaction already started. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpclose()
native void org.endurox.AtmiCtx.tpclose |
( |
| ) |
|
Close XA sub-system. This shall be called after the processing thread terminates.
See tpopen(3) manpage for more information.
- Exceptions
-
AtmiTPERMERRException | Resource Manager failed. The tpstrerror() will provide more info from last call. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. This could also be a problem with dynamical driver loading. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpcommit()
native void org.endurox.AtmiCtx.tpcommit |
( |
long |
flags | ) |
|
Function does commit the global transaction. Transaction must not be marked as abort only (e.g. in case if tpcall() failed). After issuing the command, tmsrv(8) will do the commit procedure, prepare phase first, log the results of prepare to persistent storage, and then do the actual commit.
- Parameters
-
flags | 0 or Atmiconst.TPTXCOMMITDLOG - for logged decision early return |
- Exceptions
-
AtmiTPEINVALException | flags was not 0 or was not TPTXCOMMITDLOG. |
AtmiTPETIMEException | Transaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown. |
AtmiTPEABORTException | Global transaction was marked for abort and was aborted, or prepare state failed for some of the resource managers and transaction was aborted. |
AtmiTPEHAZARDException | The state of transaction is not fully know. It can be that it is partially committed and partially aborted. |
AtmiTPEHEURISTICException | The state of transaction is not full known. The transaction heuristically completed. |
AtmiTPESVCERRException | Failed to call transaction manager, with service error. The state of transaction is unknown. |
AtmiTPEPROTOException | XA subsystem was not initialized (did not call tpopen()), no global transaction started or caller is not initiator of transaction. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpgetconn()
Connection org.endurox.AtmiCtx.tpgetconn |
( |
| ) |
throws SQLException |
Get database connection It is up to user to close the connections.
- Returns
- DB connection, null in case if there was no tpopen(), or there was tpclose().
◆ tpgetlev()
native int org.endurox.AtmiCtx.tpgetlev |
( |
| ) |
|
Return global transaction level
- Returns
- 0 - current thread is not part of global transaction. 1 - current thread is part of global transaction.
◆ tpopen()
native void org.endurox.AtmiCtx.tpopen |
( |
| ) |
|
Open the XA sub-system / open connection for ATMI Context. If Enduro/X Java XA Driver is used, then it will prepare connection connection for given Atmi Context.
See tpopen(3) manpage for more information.
- Exceptions
-
AtmiTPERMERRException | Resource Manager failed. The tpstrerror() will provide more info from last call. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. This could also be a problem with dynamical driver loading. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpresume()
native void org.endurox.AtmiCtx.tpresume |
( |
TPTRANID |
tid, |
|
|
long |
flags |
|
) |
| |
Resume global transaction with given transaction data in tranid parameter. trandid previously must be set by tpsuspend() call. To resume global transaction, XA sub-system must be open, by tpopen(). Technically it is possible that resume is done by other process than which did the suspend
- Parameters
-
tid | transaction id previosuly returned from \r tpsuspend() call. |
flags | must be set to 0 (RFU). |
- Exceptions
-
AtmiTPEINVALException | Flags was not 0. Or tranid was NULL. |
AtmiTPEPROTOException | Global transaction is already started. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. Could be the case if XA sub-system is not open by tpopen(). |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
◆ tpsuspend()
native TPTRANID org.endurox.AtmiCtx.tpsuspend |
( |
long |
flags | ) |
|
Disassociate XA transaction from context and store transaction details in returned TPRANID object. The transaction can be resumed as by doing tpresume(). tranid must not be NULL. flags are reserved for future use, and currently must be set to 0. It is error to have any open call descriptors (either by tpacall() or by tpconnect()). Suspending can be done by any involved process in transaction. But the role of participant does not change. The TPTRANID type records the information about caller, is it transaction originator or not.
- Parameters
-
flags | reserved for future use and must be be 0 |
- Returns
- allocated transaction identifier
- Exceptions
-
AtmiTPEINVALException | flags was not 0. Or tranid was NULL. |
AtmiTPEPROTOException | XA subsystem was not initialized (did not call tpopen()), global transaction was not already started, or there was open call descriptors. |
AtmiTPESYSTEMException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |
AtmiTPEOSException | System failure occurred during serving. See logs i.e. user log, or debugs for more info. |