Example usage for javax.resource.cci Connection getLocalTransaction

List of usage examples for javax.resource.cci Connection getLocalTransaction

Introduction

In this page you can find the example usage for javax.resource.cci Connection getLocalTransaction.

Prototype


public LocalTransaction getLocalTransaction() throws ResourceException;

Source Link

Document

Returns an LocalTransaction instance that enables a component to demarcate resource manager local transactions on the Connection.

Usage

From source file:org.mule.transport.cics.CtgAdapter.java

/**
 * This <code>invoke</code> method invokes a CICS application via CTG.
 * /* www .  j a va2s.  co m*/
 * @param <code>Connection</code> mainframe connection 
 * @param requestBytes a request message.
 * @return returns a reply message
 */
public byte[] invoke(Connection con, byte[] requestBytes) throws Exception {
    logger.debug("###### invoke(start) ######");

    con.getLocalTransaction().begin();

    // creates an outbound message.
    CicsRecord inRec = new CicsRecord(requestBytes);

    // invokes a transaction on mainframe and gets a reply message.
    CicsRecord outRec = execute(con, inRec);

    // gets a result as a byte array.
    byte[] resultBytes = outRec.getBytes();

    logger.debug("###### invoke( end ) ######");
    return resultBytes;
}

From source file:org.mule.transport.cics.CtgAdapter.java

/**
 * @param <code>Connection</code> mainframe connection 
 * Commit the CICS transaction.//  w  ww .ja  v a2  s  . c  om
 * */
public void commit(Connection con) throws Exception {

    if (con == null)
        return;
    LocalTransaction tran = con.getLocalTransaction();
    if (tran != null) {
        tran.commit(); // commits a transaction
        if (logger.isInfoEnabled()) {
            logger.info("CICS-Transaction [" + this.transactionID + "] commit.");
        }
    }
}

From source file:org.mule.transport.cics.CtgAdapter.java

/**
 * @param <code>Connection</code> mainframe connection 
 * Rollback the CICS transaction.//w ww  . j a v  a  2 s . c  o m
 * */
public void rollback(Connection con) throws Exception {

    if (con == null)
        return;
    LocalTransaction tran = con.getLocalTransaction();
    if (tran != null) {
        tran.rollback();
        logger.info("CICS-Transaction [" + this.transactionID + "] has been rolledback.");
    }
}

From source file:org.mule.transport.cicsStreaming.CtgAdapter.java

/**
 * This <code>invoke</code> method invokes a CICS application 
 * via CTG in a streaming manner. //w w w . j  ava 2 s  . c om
 * @param <code>Connection</code> mainframe connection 
 * @param inRec a request record
 * @param outRec a response record
 */
public void invoke(Connection con, Record inRec, Record outRec) throws Exception {
    logger.debug("###### invoke(start) ######");
    con.getLocalTransaction().begin();

    // invokes a transaction on mainframe and gets a reply message.
    execute(con, inRec, outRec);
    logger.debug("###### invoke( end ) ######");
}