List of usage examples for javax.transaction.xa Xid getGlobalTransactionId
byte[] getGlobalTransactionId();
From source file:org.wso2.andes.client.XASession_9_1.java
XaStatus commitDtx(Xid xid, boolean onePhase) throws FailoverException, AMQException, XAException { throwErrorIfClosed();//www. ja va 2 s.com DtxCommitBody dtxCommitBody = methodRegistry.createDtxCommitBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier(), onePhase); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxCommitBody.generateFrame(_channelId), DtxCommitOkBody.class); DtxCommitOkBodyImpl response = (DtxCommitOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
XaStatus rollbackDtx(Xid xid) throws FailoverException, AMQException, XAException { throwErrorIfClosed();//from ww w .j a va 2s.c o m DtxRollbackBody dtxRollbackBody = methodRegistry.createDtxRollbackBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier()); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxRollbackBody.generateFrame(_channelId), DtxRollbackOkBody.class); DtxRollbackOkBodyImpl response = (DtxRollbackOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
/** * Sends a dtx.forget frame to broker node and wait for dtx.forget-ok response * * @param xid distributed transaction ID * @return response status/*from w w w . j ava 2s .c o m*/ * @throws FailoverException if failover process started during communication with server * @throws AMQException if server sends back a error response */ public XaStatus forget(Xid xid) throws FailoverException, AMQException, XAException { throwErrorIfClosed(); DtxForgetBody dtxForgetBody = methodRegistry.createDtxForgetBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier()); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxForgetBody.generateFrame(_channelId), DtxForgetOkBody.class); DtxForgetOkBodyImpl response = (DtxForgetOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
/** * Sends a dtx.set-timeout frame to broker node and wait for dtx.set-timeout-ok response * * @param xid distribute transction ID * @param timeout transaction timeout value to set * @return response status/*from ww w. jav a 2s .c o m*/ * @throws FailoverException if failover process started during communication with server * @throws AMQException if server sends back a error response */ XaStatus setDtxTimeout(Xid xid, int timeout) throws FailoverException, AMQException, XAException { throwErrorIfClosed(); DtxSetTimeoutBody dtxSetTimeoutBody = methodRegistry.createDtxSetTimeoutBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier(), timeout); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxSetTimeoutBody.generateFrame(_channelId), DtxSetTimeoutOkBody.class); DtxSetTimeoutOkBodyImpl response = (DtxSetTimeoutOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }