Used to indicate that an application local transaction has been rolled
back. Notifies the connection event listeners.

@param connection
the connection on which the transaction was started
543332
void localTransactionRolledBack(final SibRaConnection connection) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "localTransactionRolledBack", connection);
        }

        final ConnectionEvent event = new ConnectionEvent(this,
                ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
        event.setConnectionHandle(connection);

        for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {

            final ConnectionEventListener listener = (ConnectionEventListener) iterator
                    .next();
            listener.localTransactionRolledback(event);

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "localTransactionRolledBack");
        }

    }
574274
protected void setSICoreConnection(SICoreConnection connection)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSICoreConnection", connection);

      //Retrieve Client Conversation State if necessary
      validateConversationState();
      cConState.setSICoreConnection(connection);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSICoreConnection");
   }
1199807
@Override
    public final synchronized void rollback(ContainerTx tx)
                    throws RemoteException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "rollback: " + StateStrs[state], tx);

        if (removed) {
            if (isTraceOn && tc.isEntryEnabled())
                Tr.exit(tc, "rollback: removed");
            return;
        }

        switch (state)
        {
        // These are the "normal" rollback points
            case COMMITTING_OUTSIDE_METHOD:
            case TX_METHOD_READY:
            case AFTER_BEGIN: // d159152

                setState(METHOD_READY);
                break;

            // We also could be rolledback "unexpectedly" at these points
            case TX_IN_METHOD:
            case REMOVING: // d159152

                setState(IN_METHOD);
                break;

            // Rollback in the DESTROYED state can/should only occur if there
            // was an exception from the customer beforeCompletion method.
            // Otherwise, the bean should have been delisted.                d160910
            case DESTROYED:
                if (ivBeforeCompletion != null || sessionSync != null)
                {
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "SessionSynchronization.beforeCompletion exception?");
                }
                else
                {
                    if (isTraceOn && tc.isEntryEnabled())
                        Tr.exit(tc, "rollback: InvalidBeanOStateException: " +
                                    StateStrs[state]);
                    throw new InvalidBeanOStateException(StateStrs[state],
                                    "COMMITTING_OUTSIDE_METHOD | " +
                                                    "TX_METHOD_READY | TX_IN_METHOD");
                }
                break;

            default:
                if (isTraceOn && tc.isEntryEnabled())
                    Tr.exit(tc, "rollback: InvalidBeanOStateException: " +
                                StateStrs[state]);
                throw new InvalidBeanOStateException(StateStrs[state],
                                "COMMITTING_OUTSIDE_METHOD | " +
                                                "TX_METHOD_READY | TX_IN_METHOD");

        }

        if (tx.ivRemoveBeanO == this)
        {
            completeRemoveMethod(tx); // d647928
        }
        else
        {
            // Perform normal afterCompletion processing.... calling
            // afterCompletion if present.
            // Save the above determined state and set to AFTER_COMPLETION for
            // the duration of the afterCompletion callback.                d159152
            int savedState = state;
            setState(AFTER_COMPLETION);

            // Session Synchronization AfterCompletion needs to be called if either
            // the annotation (or XML) was specified or the bean implemented
            // the interface and a global transaction is active.        F743-25855
            if ((ivAfterCompletion != null || sessionSync != null) &&
                tx.isTransactionGlobal())
            {
                EJBThreadData threadData = EJSContainer.getThreadData();

                threadData.pushContexts(this);
                try
                {
                    if (ivAfterCompletion != null) {
                        invokeSessionSynchMethod(ivAfterCompletion, new Object[] { false });
                    } else {
                        sessionSync.afterCompletion(false);
                    }
                } finally
                {
                    threadData.popContexts();
                }
            }

            setState(savedState); // d159152
        }

        // currentTx is now reset in atCommit/atRollback AFTER the final pin
        // is undone.                                                      d258770
        // currentTx = null;                                            // PQ99986

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "rollback: " + StateStrs[state]);
    }
794877
public void returnConnection(DataConnection connection) {
        if (connection.isUsable()) {
            connection.setLastUsage(new Date());
            availableConnections.add(connection);
        }
        else {
            connection.close();
        }

        usedConnections.remove(connection);
    }
996947
public static void endTransaction() {
        ifNotNullThen(localConnection.get(),
                () -> {
                    Connection connection = localConnection.get();
                    ifThen(connection.isRollbackOnClose(), connection::close);
                    localConnection.remove();
                });
    }
255607
public void localRollback()
    {
        log.info("Rollback was called, do rollback on current connection " + con);
        if (!this.isInLocalTransaction)
        {
            throw new PersistenceBrokerException("Not in transaction, cannot abort");
        }
        try
        {
            //truncate the local transaction
            this.isInLocalTransaction = false;
            if(!broker.isManaged())
            {
                if (batchCon != null)
                {
                    batchCon.rollback();
                }
                else if (con != null && !con.isClosed())
                {
                    con.rollback();
                }
            }
            else
            {
                if(log.isEnabledFor(Logger.INFO)) log.info(
                        "Found managed environment setting in PB, will ignore rollback call on connection, this should be done by JTA");
            }
        }
        catch (SQLException e)
        {
            log.error("Rollback on the underlying connection failed", e);
        }
        finally
        {
            try
            {
            	restoreAutoCommitState();
		    }
            catch(OJBRuntimeException ignore)
            {
			    // Ignore or log exception
		    }
            releaseConnection();
        }
    }
1295395
public static void rollback()
   {
      try {
         if (userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION) {
            userTransaction.rollback();
         }
         else {
            LOGGER.warn("Request to rollback transaction when none was in started.");
         }
      }
      catch (Exception e) {
         LOGGER.warn("Transaction rollback failed.", e);
      }
   }
72814
static void rollbackIfActive(Transaction transaction) {
    try {
      if (transaction != null && transaction.isActive()) {
        transaction.rollback();
      }
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }
521424
@SuppressWarnings("unchecked")
    private void performRollback(Subscriber<? super T> subscriber, State state) {
        debug("rolling back");
        query.context().endTransactionObserve();
        Conditions.checkTrue(!Util.isAutoCommit(state.con));
        Util.rollback(state.con);
        // must close before onNext so that connection is released and is
        // available to a query that might process the onNext
        close(state);
        subscriber.onNext((T) Integer.valueOf(0));
        debug("rolled back");
        complete(subscriber);
    }
982927
public void connectionDidLeave(final RespokeConnection connection) {
        members.remove(connection);

        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                Listener listener = listenerReference.get();
                if (null != listener) {
                    listener.onLeave(connection, RespokeGroup.this);
                }
            }
        });
    }
596287
void rollback() {
		if (connection != null) {
			try {
				connection.rollback();
			} catch (SQLException e) {
				throw new UroborosqlSQLException(e);
			}
		}
		clearState();
	}
787248
@Override
    public void rollback(Xid xid) throws XAException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled())
            Tr.entry(this, tc, "rollback");

        if (getMcWrapper().isMCAborted()) {
            Tr.exit(tc, "Connection was aborted. Exiting rollback.");
            return;
        }

        this.hasRollbackOccured = true;

        try {
            xaResource.rollback(xid);
        } catch (XAException e) {
            processXAException(e);
            com.ibm.ws.ffdc.FFDCFilter.processException(
                                                        e,
                                                        "com.ibm.ejs.j2c.XATransactionWrapper.rollback",
                                                        "755",
                                                        this);
            if (!mcWrapper.isStale()) {
                Tr.error(tc, "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027", "rollback", xid, e, mcWrapper.gConfigProps.cfName);
            }
            if (isTracingEnabled && tc.isEntryEnabled())
                Tr.exit(this, tc, "rollback", e);
            throw e;
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(
                                                        e,
                                                        "com.ibm.ejs.j2c.XATransactionWrapper.rollback",
                                                        "761",
                                                        this);
            if (!mcWrapper.shouldBeDestroyed()) {
                mcWrapper.markTransactionError();
                Tr.error(tc, "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027", "rollback", xid, e, mcWrapper.gConfigProps.cfName);
            }
            XAException x = new XAException("Exception:" + e.toString());
            x.initCause(e);
            if (isTracingEnabled && tc.isEntryEnabled())
                Tr.exit(this, tc, "rollback", x);
            throw x;
        }

        if (isTracingEnabled && tc.isEntryEnabled())
            Tr.exit(this, tc, "rollback");
    }
491700
protected void commitLocalConnection(Connection connection) {
    try {
      if (connection != null ) {
        connection.commit();
      }
    } catch (SQLException e) {
      if (logger.isTraceEnabled()) {
        logger.trace(e.getMessage());
      }
    }
  }
1347452
void setSICoreConnection(final SICoreConnection connection) {

        if (TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "setSICoreConnection", connection);
        }

        _coreConnection = connection;

        if (TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "setSICoreConnection");             //412795
        }

    }
1288938
@Override
    public void rollback(Xid xid) throws XAException {

        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "rollback");
        }

        /*
         *
         * if (this.xid != null && !xid.equals(this.xid)) {
         * final XAException e = new XAException(XAException.XAER_NOTA);
         * // What does this error really mean. Need to resolve
         * if (tc.isEventEnabled())
         * Tr.event(this, tc, "Error: Connection is already involved in different transaction.", e);
         * throw e;
         * }
         */
		 
        if (getMcWrapper().isMCAborted()) {
            Tr.exit(tc, "Connection was aborted. Exiting rollback.");
            return;
        }

        this.hasRollbackOccured = true;
        boolean exceptionCaught = false;
        try {
            localTransaction.rollback();
        } catch (Exception e) {
            if (!mcWrapper.isMCAborted())
                com.ibm.ws.ffdc.FFDCFilter.processException(e, getClass().getName(), "198", this);
            if (!mcWrapper.shouldBeDestroyed()) {
                mcWrapper.markTransactionError(); // Can't trust the connection since we don't know why it failed.
                Tr.error(tc, "XA_END_EXCP_J2CA0024", "rollback", xid, e, "XAException", mcWrapper.gConfigProps.getXpathId());
            }
            exceptionCaught = true;
            XAException xae = new XAException(XAException.XAER_RMFAIL);
            xae.initCause(e);
            if (tc.isEntryEnabled())
                Tr.exit(this, tc, "rollback", e);
            throw xae;
        } finally {
            //this.xid = null;
            try {
                if (registeredForSync == false) {
                    // Since we didn't register for synchronization for unshared/LTC/res-control=Application.
                    //  Instead of cleanup being done via after completion it will either happen at close or
                    //  commit/rollback which ever happens last.  This will allow the connection to be returned
                    //  to the pool prior to the end of the LTC scope allowing better utilization of the connection.
                    if (tc.isDebugEnabled()) {
                        Tr.debug(this, tc, "rollback: calling afterCompletionCode() for cleanup");
                    }
                    afterCompletion(0);
                }
            } catch (Exception e) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "rollback: caught exception in finally block: ", e);
                }
                if (exceptionCaught == false) {
                    XAException xae = new XAException(XAException.XAER_RMFAIL);
                    xae.initCause(e);
                    throw xae;
                }
            }
        } // end rollback
        if (tc.isEntryEnabled())
            Tr.exit(this, tc, "rollback");
    }
1165819
public static void release(Statement statement, Connection connection) {

        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (connection != null) {
            JDBCUtils.release(connection);
        }
    }
575348
private static void release(Connection connection) {
        Connection con = tl_conn.get();
        try {
            // 若不是事务连接则直接关闭，若是事务连接不执行任何操作，事务连接由提交事务方法关闭
            if (con == null || con != connection) {
                connection.close();
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }