/*
Notification from UserTransaction or UserActivitySession interface implementations
that the state of a bean-managed UOW has changed. As a result of this bean-managed
UOW change we may have to change the LTC that's on the thread.
510713
@Override
    public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this });

        try {
            // Determine the Tx change type and process.  Ensure we do what
            // we need to do as close to the context switch as possible
            switch (typeOfChange) {
                case PRE_BEGIN:
                    uowPreBegin();
                    break;
                case POST_BEGIN:
                    uowPostBegin(scope);
                    break;
                case PRE_END:
                    uowPreEnd(scope);
                    break;
                case POST_END:
                    uowPostEnd();
                    break;
                default:
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange);
            }
        } catch (IllegalStateException ise) {
            if (tc.isEntryEnabled())
                Tr.exit(tc, "contextChange", ise);
            throw ise;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "contextChange");
    }
952386
public void setUnChanged() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setUnChanged");
    changed = false;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setUnChanged");
  }
1054335
public void newTransactionHandler(PersistedTransaction tx, PersistedV2Key key) throws Exception {
        listenForUpdates(tx);
        tx.keyId = key.getId();
        tx.walletId = this.descriptor.getKey();
        tx.account = key.account;
        System.out.println("Incoming transaction captured in API service: " + tx.toString());
        transactionDAO.create(tx);
        WalletChange change = new WalletChange(tx.value, getBalance(), createKey(key.account).address, tx);
        WalletChangeMessage out = new WalletChangeMessage();
        out.setCommand(Command.BALANCE_CHANGE_RECEIVED);
        out.setKey(this.descriptor.key);
        out.setPayload(change);
        router.sendUpdate(this.descriptor.key, out);
    }
1215429
@Override
    public void afterCompletion(int status)
    {

        boolean committed = true;
        boolean reLoad = false;
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2

        if (status != Status.STATUS_COMMITTED) {
            committed = false;
        }

        if (isTraceOn && TETxLifeCycleInfo.isTraceEnabled()) // PQ74774
        { // PQ74774
            String tid = getTxId();
            if (tid != null)
            {
                if (globalTransaction)
                {
                    TETxLifeCycleInfo.traceGlobalTxAfterCompletion(tid, "Global/User Tx AfterCompletion");
                } else
                {
                    TETxLifeCycleInfo.traceLocalTxAfterCompletion(tid, "Local Tx AfterCompletion");
                }
            }
        } // PQ74774

        //d139562.11
        if (finderSyncList != null) // d173022.12
        { // d173022.12
            int numberofCallers = finderSyncList.size();
            for (int i = 0; i < numberofCallers; ++i) {
                finderSyncList.get(i).afterCompletion(status);
            }
        } // d173022.12

        if (isTraceOn && tc.isEntryEnabled()) // d144064
            Tr.entry(tc, "afterCompletion"
                     , new Object[] { Boolean.valueOf(globalTransaction), this,
                                     Boolean.valueOf(committed),
                                     Boolean.valueOf(isActivitySessionCompleting) }
                            ); //123293

        // When an EJB method ends, we need to remove bean-specific contexts from
        // the thread.  Those contexts need to be present for beforeCompletion for
        // JPA @PreUpdate, so postInvoke cannot pop the contexts prior to
        // transaction completion, but the calls to Activator.commit/.rollbackBean
        // below might unpin the currently invoked bean from the current
        // transaction, which would allow the bean to be active concurrently on
        // another thread while other transaction callbacks are running on this
        // thread.  To avoid that, pop the contexts now if this transaction is
        // being completed because an EJB method is ending.              RTC107108
        if (ivPostInvokeContext != null)
        {
            ivContainer.postInvokePopCallbackContexts(ivPostInvokeContext);
            ivPostInvokeContext = null;
        }

        try {

            if (committed) {

                // d126930.3
                // By default activitSessionCompleting is set to true.  Even if there
                // is no activitySession present.  This simply means we follow the noraml
                // ContainerTx logic for ending a transaction.

                if (isActivitySessionCompleting == true) {

                    becomeCommitted();

                    // Since we're committing, we can now allow timers queued to
                    // start to be started (not in this list if also cancelled).
                    if (timersQueuedToStart != null) {
                        for (TimerNpImpl timer : timersQueuedToStart.values()) {
                            timer.start();
                        }
                    }

                    // Any timers canceled in this global tran were added to
                    // timersCanceled in case they needed to be re-created in
                    // rollback.  Since we're not rolling back, go ahead and
                    // destroy these, then clear this map
                    if (timersCanceled != null) {
                        for (TimerNpImpl timer : timersCanceled.values()) {
                            timer.remove(true); // RTC107334
                        }
                    }

                    // d111555  Only perform if a beanO has been enlisted
                    if (ivBeanOsEnlistedInTx) {
                        //115597 changed to use afterList
                        int afterListSize = afterList.size(); // d122418-5
                        for (int i = 0; i < afterListSize; i++) // d122418-5
                        {
                            BeanO beanO = afterList.get(i); // d122418-5
                            try {
                                beanO.commit(this);
                            } catch (Throwable ex) {
                                FFDCFilter.processException(ex,
                                                            CLASS_NAME + ".afterCompletion",
                                                            "795", this);
                                if (isTraceOn && tc.isEventEnabled()) // d144064
                                    Tr.event(tc, "Exception thrown in commit()",
                                             new Object[] { beanO, ex });
                            } finally {
                                // Perform the Activation Strategy afterCompletion -
                                // commit processing. Ignore any exception that may
                                // occur, as the transaction has already committed
                                // and insure the rest of the beans in the list
                                // get processed to minimize side effects of any
                                // failure here.                                 d145697
                                try {
                                    ivContainer.activator.commitBean(this, beanO);
                                } catch (Throwable ex) {
                                    FFDCFilter.processException(ex,
                                                                CLASS_NAME +
                                                                                ".afterCompletion",
                                                                "811", this);
                                    if (isTraceOn && tc.isEventEnabled())
                                        Tr.event(tc, "Exception thrown in commitBean()",
                                                 new Object[] { beanO, ex });
                                }
                            }
                        } // end for
                    } // if ivBeanOsEnlistedInTx               // d111555

                    // d126930.3
                    // --------------------------------------------------------------
                    // Special case added for mid-activitySession checkpoint.  Entity
                    // beans enlisted in local transactions must be stored during
                    // the checkpoint.  This occured at beforeCompletion time.  Here
                    // we just do nothing, to make sure the bean's state does not
                    // not change.
                    // --------------------------------------------------------------

                } else { //checkpoint/reset processing

                    reLoad = true;

                } // end else (special case for mid-ActivitySession checkpoint)

            } else { // JTS Status is Rollback

                // d126930.3
                // By default activitSessionCompleting is set to true.  Even if there
                // is no activitySession present.  This simply means we follow the normal
                // ContainerTx logic for ending a transaction.

                if (isActivitySessionCompleting == true) {

                    becomeRolledback();

                    // re-start any timers that had been cancelled in this global tran
                    if (timersCanceled != null) {
                        for (TimerNpImpl timer : timersCanceled.values()) {
                            timer.start();
                            if (isTraceOn && tc.isDebugEnabled()) {
                                Tr.debug(tc, "rollback re-started queued-as-canceled timer: " + timer);
                            }
                        }
                    }

                    // Do not start timers queued to start.  Rather, mark them
                    // destroyed and clear the queue.
                    if (timersQueuedToStart != null) {
                        for (TimerNpImpl timer : timersQueuedToStart.values()) {
                            timer.remove(true); // RTC107334
                            if (isTraceOn && tc.isDebugEnabled()) {
                                Tr.debug(tc, "rollback destroyed queued-to-start timer: " + timer);
                            }
                        }
                    }

                    // d111555 only preform if one or more beans in tx
                    if (ivBeanOsEnlistedInTx) { // d111555
                        int afterListSize = afterList.size(); // d122418-5
                        //d115597 changed to use afterList
                        for (int i = 0; i < afterListSize; i++) // d122418-5
                        {
                            BeanO beanO = afterList.get(i); // d122418-5
                            try {
                                beanO.rollback(this);
                            } catch (Throwable ex) {
                                FFDCFilter.processException(ex,
                                                            CLASS_NAME + ".afterCompletion",
                                                            "863", this);
                                if (isTraceOn && tc.isEventEnabled()) // d144064
                                    Tr.event(tc, "Exception thrown in rollback()",
                                             new Object[] { beanO, ex });
                            } finally {
                                // Perform the Activation Strategy afterCompletion -
                                // commit processing. Ignore any exception that may
                                // occur, as the transaction has already committed
                                // and insure the rest of the beans in the list
                                // get processed to minimize side effects of any
                                // failure here.                                 d145697
                                try {
                                    ivContainer.activator.rollbackBean(this, beanO);
                                } catch (Throwable ex) {
                                    FFDCFilter.processException(ex,
                                                                CLASS_NAME +
                                                                                ".afterCompletion",
                                                                "879", this);
                                    if (isTraceOn && tc.isEventEnabled())
                                        Tr.event(tc, "Exception thrown in rollbackBean()",
                                                 new Object[] { beanO, ex });
                                }
                            }
                        } // while
                    } // if ivBeanOsEnlistedInTx              // d111555

                    // d126930.3
                    // -------------------------------------------------------------
                    // Special case added for mid-activitySession reset.  Entity
                    // beans enlisted in local transactions must be reloaded
                    // from the backing store to erase any in-memory updates that
                    // were done up to this point (ie. reset them).  For other bean
                    // types, we do nothing on mid-activitySession reset. The local
                    // transaction service will make a setCompleting = false call on
                    // the containerSynchronization interface, followed by an
                    // afterCompletion call.  These calls are not preceeded a
                    // a beforeCompletion call.  The beans' state should not be
                    // changed.  We just reload them.
                    // -------------------------------------------------------------

                } else {
                    reLoad = true;
                }

            } // end else (rollback)

        } catch (Throwable t) {

            FFDCFilter.processException(t, CLASS_NAME + ".afterCompletion",
                                        "913", this);
            if (isTraceOn && tc.isEventEnabled()) // d144064
                Tr.event(tc, "Exception during afterCompletion", t);
            throw new RuntimeException(t.toString());

        } finally { //110762.1

            // Persistence Manager wants notified

            try {
                if (txListener != null)
                    try {
                        txListener.afterCompletion(status); // d160445
                        txListener = null;
                    } catch (Throwable e) {
                        FFDCFilter.processException(e, CLASS_NAME + ".afterCompletion",
                                                    "929", this);
                        throw new Exception("txListener exception" + e.toString());
                    }
            } catch (Throwable e) {
                FFDCFilter.processException(e, CLASS_NAME + ".afterCompletion",
                                            "934", this);
            }

            if (!reLoad)
                ivContainer.containerTxCompleted(this); //d153430 added reLoad flag
        } // end finally

        // Activity session checkpoint.

        if (reLoad && afterList != null && !afterList.isEmpty()) { // d630940
            // Reset flag so beans will return to normal ContainerTx logic
            // unless another activitySession checkpoint or reset call is made.

            // Save the BeanOs processed in the following loop in an instance variable
            // so methods called from the customer callbacks can determine which beanO
            // is active on the thread. Access the BeanO in the loop in a local
            // variable for performance.                                       d168509
            EJBThreadData threadData = EJSContainer.getThreadData(); // d630940
            boolean popCallbackBeanO = false;
            ComponentMetaData prevCMD = null;
            boolean resetCMD = false;
            ClassLoader prevClassLoader = null;
            Object origClassLoader = ThreadContextAccessor.UNCHANGED;

            try
            {
                int afterListSize = afterList.size();
                for (int i = 0; i < afterListSize; i++)
                {
                    BeanO beanO = afterList.get(i);
                    try
                    {
                        BeanMetaData bmd = beanO.home.beanMetaData;

                        if (bmd.type == InternalConstants.TYPE_CONTAINER_MANAGED_ENTITY ||
                            bmd.type == InternalConstants.TYPE_BEAN_MANAGED_ENTITY)
                        {
                            attachListener();
                            if (txListener != null) {
                                txListener.afterBegin();
                            } else {
                                throw new Exception("Error: Null Transaction Listener");
                            }

                            // If the Entity bean has exclusive access to the data
                            // (OptA) or the LoadPolicy has defined a reload interval
                            // (ReadOnly), then there is no need to re-load the
                            // bean.  Otherwise, the Entity bean must be reloaded
                            // to acquire the proper DB locks. The forUpdate = false
                            // parameter has no effect because these are EJB 2.0
                            // beans.  Both BMP and CMP entities must use the
                            // access intent information from the application
                            // profile to determine the locking requirements.
                            // Also, we make sure the correct ComponentMetaData
                            // and local transaction context is on the thread before
                            // loading the bean.
                            if (bmd.optionACommitOption ||
                                bmd.ivCacheReloadType != BeanMetaData.CACHE_RELOAD_NONE)
                            {
                                // Bean is not re-loaded, but PM needs to be informed
                                // the bean is enlisted with the tran.               LI3408
                                ((EntityBeanO) beanO).enlistForOptionA(this);
                            }
                            else
                            {
                                threadData.pushCallbackBeanO(beanO); // d168509, d630940
                                popCallbackBeanO = true;

                                // Update the thread CMD if it's not the same as the
                                // previous bean and this is a bean-managed bean.
                                if (bmd != prevCMD &&
                                    bmd.type == InternalConstants.TYPE_BEAN_MANAGED_ENTITY)
                                {
                                    if (resetCMD)
                                    {
                                        cmdAccessor.endContext();
                                    }

                                    cmdAccessor.beginContext(bmd);
                                    prevCMD = bmd;
                                    resetCMD = true;

                                    // Update the class loader if it's not the same as the
                                    // previous bean.                         PK51366, PK83186
                                    ClassLoader classLoader = bmd.ivContextClassLoader; // F85059
                                    if (classLoader != prevClassLoader)
                                    {
                                        prevClassLoader = classLoader;
                                        origClassLoader = EJBThreadData.svThreadContextAccessor.repushContextClassLoaderForUnprivileged(origClassLoader, classLoader);
                                    }
                                }

                                Object cmdCtxSet = null;
                                TxContextChange changedContext = null;
                                try {
                                    cmdCtxSet = cmdAccessor.beginContext(bmd);
                                    changedContext = uowCtrl.setupLocalTxContext(beanO.getId());
                                    ((EntityBeanO) beanO).load(this, false);
                                } finally {
                                    uowCtrl.teardownLocalTxContext(changedContext);
                                    if (cmdCtxSet != null) {
                                        cmdAccessor.endContext();
                                    }
                                }

                                popCallbackBeanO = false;
                                threadData.popCallbackBeanO();
                            }
                        }

                    } catch (Throwable ex) {
                        FFDCFilter.processException(ex,
                                                    CLASS_NAME + ".afterCompletion",
                                                    "978", this);
                        if (isTraceOn && tc.isEventEnabled()) // d144064
                            Tr.event(tc, "Exception thrown attempting to reload bean " +
                                         "due to activitySession reset",
                                     new Object[] { beanO, ex });

                        //d135218 - added destroy, setRollbackOnly, logException, &
                        //          throw exception below to match beforeCompletion
                        //          logic since ActiviySession reset occurs during
                        //          the middle of a local transaction, not at the
                        //          end, like afterCompletion usually handles.

                        // Destroy the beanO, too late to delist. Destroying it should
                        // take care of the state when the transaction is rolled back
                        beanO.destroy();

                        ivContainer.uowCtrl.setRollbackOnly();

                        // Log the exception
                        ExceptionUtil.logException(tc, ex, null, beanO);

                        // Inform the activitySession service that reset
                        // failed.
                        throw new RuntimeException(ex.toString());

                    }
                } // end for loop
            } finally
            {
                EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(origClassLoader);

                if (resetCMD)
                {
                    cmdAccessor.endContext();
                }

                if (popCallbackBeanO)
                {
                    threadData.popCallbackBeanO();
                }
            }

        } // end else (special case for mid-ActivitySession reset)

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "afterCompletion"); // d144064

    }
201240
protected void doRollback(DefaultTransactionStatus status) {
        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
                .getTransaction();

        super.doRollback(new DefaultTransactionStatus(actualTransactionObject
                .getHibernateTransactionObject(), status.isNewTransaction(),
                status.isNewSynchronization(), status.isReadOnly(), status
                        .isDebug(), status.getSuspendedResources()));
        ldapManagerDelegate.doRollback(new DefaultTransactionStatus(
                actualTransactionObject.getLdapTransactionObject(), status
                        .isNewTransaction(), status.isNewSynchronization(),
                status.isReadOnly(), status.isDebug(), status
                        .getSuspendedResources()));
    }
1210958
private void  handleLeadershipChange(NotificationContext changeContext) {
    if (this.helixManager.isPresent() && this.helixManager.get().isLeader()) {
      LOGGER.info("Leader notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
          this.helixManager.get().isLeader());

      if (this.isSchedulerEnabled) {
        LOGGER.info("Gobblin Service is now running in master instance mode, enabling Scheduler.");
        this.scheduler.setActive(true);
      }

      if (this.isGitConfigMonitorEnabled) {
        this.gitConfigMonitor.setActive(true);
      }

      if (this.isDagManagerEnabled) {
        //Activate DagManager only if TopologyCatalog is initialized. If not; skip activation.
        if (this.topologyCatalog.getInitComplete().getCount() == 0) {
          this.dagManager.setActive(true);
        }
      }
    } else if (this.helixManager.isPresent()) {
      LOGGER.info("Leader lost notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
          this.helixManager.get().isLeader());
      if (this.isSchedulerEnabled) {
        LOGGER.info("Gobblin Service is now running in slave instance mode, disabling Scheduler.");
        this.scheduler.setActive(false);
      }

      if (this.isGitConfigMonitorEnabled) {
        this.gitConfigMonitor.setActive(false);
      }

      if (this.isDagManagerEnabled) {
        this.dagManager.setActive(false);
      }
    }
  }
503973
@Override
	public void submitResourceModified(final ResourceModifiedMessage theMsg) {
		/*
		 * We only want to submit the message to the processing queue once the
		 * transaction is committed. We do this in order to make sure that the
		 * data is actually in the DB, in case it's the database matcher.
		 */
		if (TransactionSynchronizationManager.isSynchronizationActive()) {
			TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
				@Override
				public int getOrder() {
					return 0;
				}

				@Override
				public void afterCommit() {
					sendToProcessingChannel(theMsg);
				}
			});
		} else {
			sendToProcessingChannel(theMsg);
		}
	}
575960
public void updateCharging(String subscriptionId, String serviceContextId, long units) throws Exception {
    // Fetch existing Ro session
    ClientCCASession roSession = roSessions.get(serviceContextId);

    // Create and Send CCR (UPDATE)
    JCreditControlRequest updateCCR = createCCR(CC_REQUEST_TYPE_UPDATE, subscriptionId, serviceContextId);
    roSession.sendCreditControlRequest(updateCCR);

    switchStateMachine(SENT_CCR_UPDATE);
  }
1113372
protected void doHandleChanged() {
		// If there is an associated action, execute it
		if (getActionOnChange() != null) {
			final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());
			final boolean isCAT = isCurrentAjaxTrigger();
			Runnable later = new Runnable() {
				@Override
				public void run() {
					getActionOnChange().execute(event);
					if (isCAT && UIContextHolder.getCurrent().getFocussed() == null) {
						setFocussed();
					}
				}
			};

			invokeLater(later);
		} else if (AjaxHelper.isCurrentAjaxTrigger(this) && UIContextHolder.getCurrent().getFocussed() == null) {
			setFocussed();
		}
	}
894317
@Override
    public void registerCallback(UOWScopeCallback callback) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "registerCallback", callback);

        UserTransactionImpl.instance().registerCallback(callback);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "registerCallback");
    }
430973
protected void suspendTransaction() {
        //create local variable - JIT performance improvement
        final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SUSPEND_TRANSACTION]);
        }
        Object[] suspendedTx = { null, null }; // PM56632
        //        UOWCurrent uowCurrent = TransactionManagerFactory.getUOWCurrent();
        UOWCurrent uowCurrent = this.getDatabaseStoreService().getUOWCurrent();
        UOWCoordinator uowCoord = uowCurrent.getUOWCoord();
        //        LocalTransactionCurrent ltCurrent = TransactionManagerFactory.getLocalTransactionCurrent(); //d120870.2
        LocalTransactionCurrent ltCurrent = this.getDatabaseStoreService().getLocalTransactionCurrent();

        if (uowCoord == null) {
            // There is no Global or Local Transaction
            // We must start a LocalTransaction
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "No Global or Local Transaction exists");
            }
        } else if (!uowCoord.isGlobal()) {
            // There is a LocalTransaction, it must be suspended
            // and a new LocalTransaction begun
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "LocalTransaction is active so suspend");
            }
            // Suspend the LocalTransaction and return the LocalTransactionCoordinator as an Object
            suspendedTx[0] = (Object) ltCurrent.suspend();

        } else {
            // else we have a global transaction
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Global Transaction is Active");
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Global Transaction is Active so suspend");
            }
            try {
                //                suspendedTx = TransactionManagerFactory.getTransactionManager().suspend();
                suspendedTx[0] = this.getDatabaseStoreService().getEmbeddableWebSphereTransactionManager().suspend();
            } catch (Throwable th) {
                // Only required as JTA specifies exception, but implementation never throws one
            }
            // START: PM56632 need to check if there is a local transaction since global suspend does not suspend local transaction
            uowCoord = this.getDatabaseStoreService().getUOWCurrent().getUOWCoord();
            if (uowCoord != null && !uowCoord.isGlobal()) {
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "LocalTransaction is active after global suspend");
                }
                // Suspend the LocalTransaction and return the LocalTransactionCoordinator as an Object
                suspendedTx[1] = (Object) ltCurrent.suspend();
            }
            // END: PM56632
        }

        if (suspendedTx[0] != null || suspendedTx[1] != null)
            suspendedTransactions.put(Thread.currentThread(), suspendedTx);

        try {
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Starting a Local Transaction");
            }
            //            ltCurrent.begin();
            boolean boundaryIsAS = false; // true if the boundary is ActivitySession; false if the boundary is BeanMethod
            boolean unresActionIsCommit = false; // true if the unresolved action is commit; false if it is rollback
            boolean resolverIsCAB = false; // true if the resolver is ContainerAtBoundary; false if it is Application
            //          The following Starts a new LTC scope and associates it with the current thread.
            //          The configuration of the LTC is determined by the caller rather than via J2EE component metadata.
            //          Throws IllegalStateException if the LocalTransactionCoordinator is not in a
            //          valid state to execute the operation, for example if a global transaction is active.
            ltCurrent.begin(boundaryIsAS, unresActionIsCommit, resolverIsCAB);
        } catch (Exception ex) {
            // Absorb any exception to ensure we still exit cleanly and resume
            // any suspended LTC in postInvoke.
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SUSPEND_TRANSACTION], "DatabaseHashMap.cantstartLTC");
        }

        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUSPEND_TRANSACTION]);
        }
    }
392100
private static boolean isPeerChanged(Change change, ChangedIssue issue) {
    Optional<User> assignee = issue.getAssignee();
    return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin());
  }
866262
protected void activeStatusChanged(boolean newActiveState) throws PushStateException {
      active = newActiveState;
      log.debugf("changed mode %s", this);
      if (active && singletonConfiguration.pushStateWhenCoordinator())
         doPushState();
   }
225602
@Override
    public SIUncoordinatedTransaction createUncoordinatedTransaction(boolean allowSubordinateResources)
                    throws SIConnectionUnavailableException, SIConnectionDroppedException,
                    SIErrorException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "createUncoordinatedTransaction",
                        new Object[] { this, Boolean.valueOf(allowSubordinateResources) });

        LocalTransaction tran = null;

        // Synchronize on the close object, we don't want the connection closing
        // while we try to add the transaction.
        synchronized (this)
        {
            // See if this connection has been closed
            checkNotClosed();
            checkMPStarted();

            //Get a LocalTransaction from the message store (via the MP).
            tran = _txManager.createLocalTransaction(!allowSubordinateResources);

            synchronized (_ownedTransactions)
            {
                // Add this transaction to the connections list in case we need to
                // clean them up at close time.
                _ownedTransactions.add(tran);
                tran.registerCallback(this);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "createUncoordinatedTransaction", tran);

        return tran;
    }
813613
@Override
    public void localTransactionStarted(ConnectionEvent event) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "localTransactionStarted");
        }

        if (event.getId() == ConnectionEvent.LOCAL_TRANSACTION_STARTED) {

            //
            // The LocalTransactionStarted event for local transaction connections is analogous to the
            //  InteractionPending event for xa transaction connections.  JMS's usage of ManagedSessions
            //  is very dependent on the ability to use these two events for properly enlisting their
            //  unshared connections.  When a ManagedSession is first created, it is done under an LTC.
            //  When that LTC ends, some partial cleanup is done on the MCWrapper, but it is not put
            //  back into the pool because the unshared connection handle is still active.  One of the
            //  items that gets cleaned up is the coordinator within the MCWrapper.  This makes sense
            //  since the LTC has ended.  But, when it is determined by JMS that it's time to get
            //  enlisted in the current transaction, a null coordinator causes all kinds of problems
            //  (reference the string of defects that have attempted to correct this situation).  The
            //  solution determined seems to be the right one.  In both localTransactionStarted
            //  and interactionPending methods, we need to check if the MCWrapper coordinator is null and
            //  if it is null, then go out to the TM and get it updated.
            //
            // Note that this special null coordinator processing is due to the SmartHandle support
            //  utilized by JMS and RRA.  Without smart handles, the coordinator would have gotten
            //  re-initialized during the handle re-association logic.
            //
            // In addition, we have determined that the check for involvedInTransaction() is not necessary
            //  (and causes problems for the scenario described just previous).  Since the getCurrentTranWrapper()
            //  already checks for a valid state setting before returning, we can just rely on that method to
            //  do the proper checking instead of calling the involvedInTransaction() method.
            //
            UOWCoordinator uowCoordinator = mcWrapper.getUOWCoordinator();

            if (uowCoordinator == null) {
                uowCoordinator = mcWrapper.updateUOWCoordinator();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "uowCoord was null, updating it to current coordinator");
                }
            }

            // if the coordinator is still null, then we are running with NO transaction
            //  context on the thread.  This case currently needs to be supported because
            //  servlets can spin their own threads which would not have context.
            // Note: it is very rare that users do this.  All other occurances are
            //  considered to be an error.
            if (uowCoordinator == null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                    Tr.exit(this, tc, "localTransactionStarted", "no transaction context, return without enlisting");
                }
                return;
            }

            /*
             * We know we are in a transaction but we need to verify that it is not a global transaction
             * before continuing.
             */
            if (tc.isDebugEnabled() && uowCoordinator.isGlobal()) {
                IllegalStateException ise = new IllegalStateException("Illegal attempt to start a local transaction within a global (user) transaction");
                Tr.debug(this, tc, "ILLEGAL_USE_OF_LOCAL_TRANSACTION_J2CA0295", ise);
            }

            /*
             * The ManagedConnection should be associated with a transaction. And, if it's not,
             * the getCurrentTranWrapper() method will detect the situation and throw an
             * exception.
             *
             * enlist() the ManagedConnection from the transaction.
             */

            try {
                mcWrapper.getCurrentTranWrapper().enlist();
            } catch (ResourceException e) {
                /*
                 * // Can't enlist, something went wrong.
                 * // Destroy the connection(s) so it can't cause any future problems.
                 * try {
                 * mcWrapper.markStale();
                 * mcWrapper.releaseToPoolManager();
                 * }
                 * catch (Exception ex) {
                 * // Nothing to do here. PoolManager has already logged it.
                 * // Since we are in cleanup mode, we will not surface a Runtime exception to the ResourceAdapter
                 * FFDCFilter.processException(ex, "com.ibm.ejs.j2c.ConnectionEventListener.localTransactionStarted", "473", this);
                 * if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                 * Tr.debug(this, tc, "localTransactionStarted: Error when trying to enlist " + mcWrapper.getPoolManager().getPmiName() +
                 * " caught exception, but will continue processing: ", ex);
                 * }
                 * }
                 */

                FFDCFilter.processException(e, "com.ibm.ejs.j2c.ConnectionEventListener.localTransactionStarted", "481", this);
                // add datasource name to message
                Tr.error(tc, "ENLIST_FAILED_J2CA0074", "localTransactionStarted", e, mcWrapper.gConfigProps.cfName);
                // Moved event.getSource() inside of catch block for performance reasons
                ManagedConnection mc = null;
                try {
                    mc = (ManagedConnection) event.getSource();
                } catch (ClassCastException cce) {
                    Tr.error(tc, "GET_SOURCE_CLASS_CAST_EXCP_J2CA0098", cce);
                    throw new IllegalStateException("ClassCastException occurred attempting to cast event.getSource to ManagedConnection");
                }
                ConnectionEvent errorEvent = new ConnectionEvent(mc, ConnectionEvent.CONNECTION_ERROR_OCCURRED);
                this.connectionErrorOccurred(errorEvent);

                RuntimeException rte = new IllegalStateException(e.getMessage());
                throw rte;
            }
        } else {
            // Connection Event passed in doesn't match the method called.
            // This should never happen unless there is an error in the ResourceAdapter.
            processBadEvent("localTransactionStarted", ConnectionEvent.LOCAL_TRANSACTION_STARTED, event);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "localTransactionStarted");
        }
        return;
    }
127368
@Override
	public void executionStateChanged(final ExecutionState newExecutionState, final String optionalMessage) {

		// Check the state transition
		ExecutionStateTransition.checkTransition(false, getTaskName(), this.executionState, newExecutionState);

		// Make sure the reason for a transition to FAILED appears in the log files
		if (newExecutionState == ExecutionState.FAILED) {
			LOG.error(optionalMessage);
		}

		// Notify all listener objects
		final Iterator<ExecutionListener> it = this.registeredListeners.iterator();
		while (it.hasNext()) {
			it.next().executionStateChanged(this.environment.getJobID(), this.vertexID, newExecutionState,
					optionalMessage);
		}

		// Store the new execution state
		this.executionState = newExecutionState;

		// Finally propagate the state change to the job manager
		this.taskManager.executionStateChanged(this.environment.getJobID(), this.vertexID, newExecutionState,
				optionalMessage);
	}
1190411
@Override
  public final boolean changeUserPasswd(final String pUserName,
    final String pPassw, final String pPasswOld) throws Exception {
    String query = "select USERTOMCAT.ITSUSER from USERTOMCAT where ITSUSER='"
      + pUserName + "' and ITSPASSWORD='" + pPasswOld + "';";
    IRecordSet<RS> recordSet = null;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (!recordSet.moveToFirst()) {
        return false;
      }
      String changeUserP =
        "update USERTOMCAT set ITSPASSWORD='" + pPassw + "' where ITSUSER='"
          + pUserName + "';";
      this.srvDatabase.executeQuery(changeUserP);
      this.srvDatabase.commitTransaction();
      return true;
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
      if (recordSet != null) {
        recordSet.close();
      }
    }
  }