setRollbackOnly - It is illegal to call this method during
ejbCreate, ejbActivate, ejbPassivate, ejbRemove and also if the
method being invoked has one of notsupported, supports or never
as its transaction attribute
494291
@Override
    public void setRollbackOnly() {
        synchronized (this) {
            // The EJB Specification does not allow this operation from any
            // of the following states.
            if (!isRollbackOnlyAllowed()) // d159152
            {
                IllegalStateException ise;

                ise = new IllegalStateException("StatefulBean: setRollbackOnly() " +
                                                "not allowed from state = " +
                                                getStateName(state));
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "setRollbackOnly: " + ise);

                throw ise;
            }
        }

        super.setRollbackOnly();
    }
885490
public void eventPostRollbackAdd(Transaction transaction) throws SevereMessageStoreException 
  {    
    super.eventPostRollbackAdd(transaction);
      
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "eventPostRollbackAdd", transaction);
      
    if (_handler != null)
    {      
      _handler.removeTopic(_topic);
        
        // If this was the last topic reference, then delete the PubSub output 
        // handler.
        if (_handler.getTopics()== null || _handler.getTopics().length == 0)
        {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "Deleting PubSubOutputHandler " + _handler);
  
          _destination.deletePubSubOutputHandler(_neighbour.getUUID());
        }

      }
      else if (_neighbours!=null)
        _neighbours.removeTopicSpaceReference(_neighbour.getUUID(), 
                                              this,
                                              _topicSpaceUuid,
                                              _topic);
      
      // Remove the subscription from the list.
      _neighbour.removeSubscription(_topicSpaceUuid, _topic);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "eventPostRollbackAdd");
  }
1296981
private void fireOnRollbackTransaction(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onRollback(e);
        }
    }
1128489
@Override
    public void commit()
    {
        if (!getRollbackOnly())
        {
            onTransaction(TxAction.COMMIT);
            ((EntityManagerImpl) entityManager).getPersistenceDelegator().commit();
        }
    }
897627
@Override
    public Class<?> getInvokedBusinessInterface()
                    throws IllegalStateException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        // d367572.1 start
        synchronized (this)
        {
            if ((state == PRE_CREATE) ||
                (state == CREATING) ||
                (state == DESTROYED))
            {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "Incorrect state: " + getStateName(state));
                throw new IllegalStateException(getStateName(state));
            }
        }
        // d367572.1 end

        Class<?> bInterface = null;
        EJSWrapperBase wrapper = null;

        // -----------------------------------------------------------------------
        // Obtain the Method Context for the current thread (EJSDeployedSupport),
        // which contains the 'wrapper' used to invoke the current method.
        //
        // The invoked 'business interface' is the first and only interface
        // for the wrapper class.
        //
        // Note that this method is NOT allowed for the EJB 2.1 component
        // interfaces... and results in an exception.
        // -----------------------------------------------------------------------

        EJSDeployedSupport methodContext = EJSContainer.getMethodContext();

        // d367572.7 start of eliminate potential NPE if methodContext is null.
        if (methodContext != null)
        {
            wrapper = methodContext.ivWrapper;

            if (wrapper != null)
            {
                // For an aggregate wrapper, all interfaces must be evaluated for
                // exposing the method. If a single interface is found, return it,
                // otherwise it is ambiguous.                             F743-34304
                if (wrapper.ivBusinessInterfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX)
                {
                    Method method = methodContext.methodInfo.ivMethod;
                    String methodName = method.getName();
                    Class<?>[] methodParams = method.getParameterTypes();
                    for (Class<?> curInterface : wrapper.bmd.ivBusinessLocalInterfaceClasses)
                    {
                        try
                        {
                            curInterface.getMethod(methodName, methodParams);
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " found on interface " + curInterface);
                            if (bInterface != null)
                            {
                                throw new IllegalStateException("Ambiguous invoked business interface.");
                            }
                            bInterface = curInterface;
                        } catch (SecurityException ex) // d679175
                        {
                            // this normal and means the interface doesn't expose this method.
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " not found on interface " + curInterface);
                        } catch (NoSuchMethodException ex) // d679175
                        {
                            // this normal and means the interface doesn't expose this method.
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " not found on interface " + curInterface);
                        }
                    }
                }

                // For performance (and in case No-Interface view) obtain the
                // 'interface' using the index provided on the wrapper, rather
                // than using reflections as done in prior releases.       F743-1756
                else if (wrapper.ivInterface == WrapperInterface.BUSINESS_LOCAL)
                {
                    bInterface = wrapper.bmd.ivBusinessLocalInterfaceClasses[wrapper.ivBusinessInterfaceIndex];
                }
                else if (wrapper.ivInterface == WrapperInterface.BUSINESS_REMOTE ||
                         wrapper.ivInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
                {
                    bInterface = wrapper.bmd.ivBusinessRemoteInterfaceClasses[wrapper.ivBusinessInterfaceIndex];
                }
            }
        } // d367572.7 end

        if (bInterface == null)
        {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "getInvokedBusinessInterface : IllegalStateException : " +
                             "Not invoked through business interface");

            throw new IllegalStateException("Not invoked through business interface");
        }

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "getInvokedBusinessInterface : " + bInterface);

        return bInterface;
    }
140320
private boolean rollbackIfNecessary(final Transactional transactional,
                                      final Exception e,
                                      final DefaultConnectionProvider conn) {
    boolean commit = true;

    //check rollback clauses
    for (Class<? extends Exception> rollBackOn : transactional.rollbackOn()) {

      //if one matched, try to perform a rollback
      if (rollBackOn.isInstance(e)) {
        commit = false;

        //check ignore clauses (supercedes rollback clause)
        for (Class<? extends Exception> exceptOn : transactional.ignore()) {
          //An exception to the rollback clause was found, DON'T rollback
          // (i.e. commit and throw anyway)
          if (exceptOn.isInstance(e)) {
            commit = true;
            break;
          }
        }

        //rollback only if nothing matched the ignore check
        if (!commit) {
          logger.debug("Rolling back JDBC transaction for this thread");
          conn.rollback();
        }
        //otherwise continue to commit

        break;
      }
    }

    return commit;
  }
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]);
    }
706038
@Override
	public void rollback() throws TransactionManagementException {
		logger.entering(CLASSNAME, "rollback");
		try {
			if (userTran.getStatus() != Status.STATUS_NO_TRANSACTION) {
				userTran.rollback();
			}
			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
		} catch (IllegalStateException e) {
			throw new TransactionManagementException(e);
		} catch (SecurityException e) {
			throw new TransactionManagementException(e);
		} catch (SystemException e) {
			throw new TransactionManagementException(e);
		}
		logger.exiting(CLASSNAME, "rollback");
	}
1331071
private boolean shouldRollback(Transactional annotation, Exception e)
	{
		return isInstanceOf(e, annotation.rollbackOn()) && !isInstanceOf(e, annotation.exceptOn());
	}
492642
public function rollback() {
        try {
            $this->getTransaction()->rollback();
        } catch(Failed $e) {
            if($e->getMessage() != 'Transaction aborted') {
                throw $e;
            }
        } catch(DbException $e) {
            if($e->getMessage() != 'There is no active transaction') {
                throw $e;
            }
        }
        $transactions = $this->getTransactions();
        unset($transactions[$this->getDbService()]);
        $this->setTransactions($transactions);

        $this->findEventsManager()->fire(self::EVENT_ROLLBACK, $this);
    }
6562
@Override
    public Exception
                    mapCSITransactionRolledBackException(EJSDeployedSupport s, CSITransactionRolledbackException ex)
                                    throws com.ibm.websphere.csi.CSIException
    {
        //d180095
        // Ensure root is set before doing the mapping.
        if (s.rootEx == null)
        {
            s.rootEx = ExceptionUtil.findRootCause(ex);
        }

        Exception mappedEx = mapException(s, ex);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "MappedException = " + mappedEx);
        }
        // set the stack trace in CORBA exception to the exception stack for
        // the root cause of the exception.
        mappedEx.setStackTrace(s.rootEx.getStackTrace());

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "returning: " + mappedEx); //150727 d402055
        }
        return mappedEx;
    }
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");
        }

    }
1286462
public final void setRollbackFor(Class<? extends Throwable>... exceptions) {
        if (ArrayUtils.isNotEmpty(exceptions)) {
            if (rollbackFor == null) {
                rollbackFor = new HashSet<>();
            }
            rollbackFor.addAll(Arrays.asList(exceptions));
        }
    }
1367127
private boolean rollbackIfNecessary(
      Transactional transactional, Exception e, EntityTransaction txn) {
    boolean commit = true;

    //check rollback clauses
    for (Class<? extends Exception> rollBackOn : transactional.rollbackOn()) {

      //if one matched, try to perform a rollback
      if (rollBackOn.isInstance(e)) {
        commit = false;

        //check ignore clauses (supercedes rollback clause)
        for (Class<? extends Exception> exceptOn : transactional.ignore()) {
          //An exception to the rollback clause was found, DON'T rollback
          // (i.e. commit and throw anyway)
          if (exceptOn.isInstance(e)) {
            commit = true;
            break;
          }
        }

        //rollback only if nothing matched the ignore check
        if (!commit) {
          txn.rollback();
        }
        //otherwise continue to commit

        break;
      }
    }

    return commit;
  }
771095
protected function postRollback()
    {
        // Unset each of the new entities' Ids
        foreach ($this->scheduledForInsertion as $objectHashId => $entity) {
            $this->entityRegistry->setEntityId($entity, null);
        }
    }
729050
public function forceRollBack()
    {
        $return = true;

        if ($this->nestedTransactionCount) {
            // If we're in a transaction, always roll it back
            // regardless of nesting level.
            $return = $this->connection->rollBack();

            // reset nested transaction count to 0 so that we don't
            // try to commit (or rollback) the transaction outside this scope.
            $this->nestedTransactionCount = 0;

            if ($this->useDebug) {
                $this->log('Rollback transaction');
            }
        }

        return $return;
    }
667644
void validateCloseCommitRollback(String functionCall) throws IllegalStateException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "validateCloseCommitRollback", functionCall);

        //Before triggering onCompletion/OnException .. SIB pushes "owning session object" to Thread Local, 
        //Now obtain the Session object from Thread Local and validate with 'this'. 
        if ((JmsSessionImpl.asyncThreadLocal.get() != null) && (JmsSessionImpl.asyncThreadLocal.get() == this)) {

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "OnComplete/onException called roolback/commit/close on its own Context/Session.");

            //the call is driven from this JmsSessionImpl object only.. throw JMSException
            throw (IllegalStateException) JmsErrorUtils.newThrowable(IllegalStateException.class,
                                                                     "INVALID_METHOD_CWSIA0515",
                                                                     new Object[] { functionCall,
                                                                                   this },
                                                                     tc
                            );

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "validateCloseCommitRollback");

    }