List of usage examples for javax.transaction.xa Xid getBranchQualifier
byte[] getBranchQualifier();
From source file:org.wso2.andes.client.XASession_9_1.java
/** * Send endDtx command to server//from ww w. j a va 2 s. co m * * @param xid a global transaction identifier to be associated with the resource * @param flag one of TMSUCCESS, TMFAIL, or TMSUSPEND. * @return XaStatus returned by server * @throws FailoverException when a connection issue is detected * @throws AMQException when an error is detected in AMQ state manager */ XaStatus endDtx(Xid xid, int flag) throws FailoverException, AMQException, XAException { throwErrorIfClosed(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Sending dtx.end for channel " + _channelId + ", xid " + xid); } DtxEndBody dtxEndBody = methodRegistry.createDtxEndBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier(), flag == XAResource.TMFAIL, flag == XAResource.TMSUSPEND); AMQMethodEvent amqMethodEvent = _connection._protocolHandler.syncWrite(dtxEndBody.generateFrame(_channelId), DtxEndOkBody.class); DtxEndOkBodyImpl response = (DtxEndOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
XaStatus prepareDtx(Xid xid) throws FailoverException, AMQException, XAException { throwErrorIfClosed();//from ww w.j a v a 2 s .c o m DtxPrepareBody dtxPrepareBody = methodRegistry.createDtxPrepareBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier()); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxPrepareBody.generateFrame(_channelId), DtxPrepareOkBody.class); DtxPrepareOkBodyImpl response = (DtxPrepareOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
XaStatus commitDtx(Xid xid, boolean onePhase) throws FailoverException, AMQException, XAException { throwErrorIfClosed();//from www . ja v a 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 v a 2 s . c om*/ 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/* w w w . java2 s .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 w w w . j a va 2 s. c om*/ * @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()); }