endurox-java
Functions
Distributed transaction processing methods

Functions

native void org.endurox.AtmiCtx.tpopen ()
 
native void org.endurox.AtmiCtx.tpclose ()
 
native void org.endurox.AtmiCtx.tpbegin (long timeout, long flags)
 
native void org.endurox.AtmiCtx.tpcommit (long flags)
 
native void org.endurox.AtmiCtx.tpabort (long flags)
 
native TPTRANID org.endurox.AtmiCtx.tpsuspend (long flags)
 
native void org.endurox.AtmiCtx.tpresume (TPTRANID tid, long flags)
 
Connection org.endurox.AtmiCtx.tpgetconn () throws SQLException
 
native int org.endurox.AtmiCtx.tpgetlev ()
 

Detailed Description

Distributed transaction processing

Function Documentation

◆ 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
flagsis reserved for future use and must be 0.
Exceptions
AtmiTPEINVALExceptionflags was not 0.
AtmiTPETIMEExceptionTransaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown.
AtmiTPEHAZARDExceptionThe state of transaction is not fully know. It can be that it is partially committed and partially aborted.
AtmiTPEHEURISTICExceptionThe state of transaction is not full known. The transaction heuristically completed.
AtmiTPESVCERRExceptionFailed to call transaction manager, with service error. The state of transaction is unknown.
AtmiTPEPROTOExceptionXA subsystem was not initialized (did not call tpopen()), no global transaction started or caller is not initiator of transaction.
AtmiTPESYSTEMExceptionSystem failure occurred during serving. See logs i.e. user log, or debugs for more info.
AtmiTPEOSExceptionSystem 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
timeoutNumber 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
AtmiTPEINVALExceptionflags was not 0.
AtmiTPETIMEExceptionTransaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown.
AtmiTPESVCERRExceptionFailed to call transaction manager, with service error. The state of transaction is unknown.
AtmiTPEPROTOExceptionXA subsystem was not initialized (did not call tpopen()) or global transaction already started.
AtmiTPESYSTEMExceptionSystem failure occurred during serving. See logs i.e. user log, or debugs for more info.
AtmiTPEOSExceptionSystem 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
AtmiTPERMERRExceptionResource Manager failed. The tpstrerror() will provide more info from last call.
AtmiTPESYSTEMExceptionSystem 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.
AtmiTPEOSExceptionSystem 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
flags0 or Atmiconst.TPTXCOMMITDLOG - for logged decision early return
Exceptions
AtmiTPEINVALExceptionflags was not 0 or was not TPTXCOMMITDLOG.
AtmiTPETIMEExceptionTransaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown.
AtmiTPEABORTExceptionGlobal transaction was marked for abort and was aborted, or prepare state failed for some of the resource managers and transaction was aborted.
AtmiTPEHAZARDExceptionThe state of transaction is not fully know. It can be that it is partially committed and partially aborted.
AtmiTPEHEURISTICExceptionThe state of transaction is not full known. The transaction heuristically completed.
AtmiTPESVCERRExceptionFailed to call transaction manager, with service error. The state of transaction is unknown.
AtmiTPEPROTOExceptionXA subsystem was not initialized (did not call tpopen()), no global transaction started or caller is not initiator of transaction.
AtmiTPESYSTEMExceptionSystem failure occurred during serving. See logs i.e. user log, or debugs for more info.
AtmiTPEOSExceptionSystem 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
AtmiTPERMERRExceptionResource Manager failed. The tpstrerror() will provide more info from last call.
AtmiTPESYSTEMExceptionSystem 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.
AtmiTPEOSExceptionSystem 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
tidtransaction id previosuly returned from \r tpsuspend() call.
flagsmust be set to 0 (RFU).
Exceptions
AtmiTPEINVALExceptionFlags was not 0. Or tranid was NULL.
AtmiTPEPROTOExceptionGlobal transaction is already started.
AtmiTPESYSTEMExceptionSystem 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().
AtmiTPEOSExceptionSystem 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
flagsreserved for future use and must be be 0
Returns
allocated transaction identifier
Exceptions
AtmiTPEINVALExceptionflags was not 0. Or tranid was NULL.
AtmiTPEPROTOExceptionXA subsystem was not initialized (did not call tpopen()), global transaction was not already started, or there was open call descriptors.
AtmiTPESYSTEMExceptionSystem failure occurred during serving. See logs i.e. user log, or debugs for more info.
AtmiTPEOSExceptionSystem failure occurred during serving. See logs i.e. user log, or debugs for more info.