Declarative Services method for setting the LocalTransactionCurrent service reference

@param ref reference to service object; type of service object is verified
163531
protected void setLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
        if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setLocalTransactionCurrent", "setting " + ref);
        }
        localTransactionCurrentRef.setReference(ref);
    }
1325813
public void processLocalTransactionStartedEvent(Object handle) throws ResourceException {

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn) 
        {
            if (tc.isEntryEnabled()) 
                Tr.entry(this, tc, "processLocalTransactionStartedEvent", handle);

            if (tc.isDebugEnabled()) 
            { 
                String cId = null;
                try {
                    cId = mcf.getCorrelator(this); 
                } catch (SQLException x) {
                    // will just log the exception here and ignore it since its in trace
                    Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
                }

                if (cId != null) {
                    StringBuffer stbuf = new StringBuffer(200);
                    stbuf.append("Correlator: DB2, ID: ");
                    stbuf.append(cId);
                    if (xares != null) {
                        stbuf.append(" Transaction : ");
                        stbuf.append(xares);
                    }
                    stbuf.append(" BEGIN");

                    Tr.debug(this, tc, stbuf.toString());
                }
            } 
        } 

        // An application level local transaction has been requested started

        //The isValid method returns an exception if it is not valid.  This allows the
        // WSStateManager to create a more detailed message than this class could.

        ResourceException re = stateMgr.isValid(WSStateManager.LT_BEGIN);
        if (re == null) {
            if (currentAutoCommit) {
                try {
                    if (isTraceOn && tc.isDebugEnabled()) 
                        Tr.debug(this, tc, "current autocommit is true, set to false");
                    setAutoCommit(false);
                } catch (SQLException sqle) {
                    FFDCFilter.processException(sqle, getClass().getName() + ".processLocalTransactionStartedEvent",
                                                "550", this);
                    throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass());
                }
            }
            // Already validated the state so just set it. 
            stateMgr.transtate = WSStateManager.LOCAL_TRANSACTION_ACTIVE;
        } else {
            throw re;
        }

        // Fill in the ConnectionEvent only if needed. 
        connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_STARTED, null, handle);

        if (isTraceOn && tc.isEventEnabled())
            Tr.event(this, tc, 
                     "Firing LOCAL TRANSACTION STARTED event for: " + handle, this);

        //Notification of the eventListeners must happen after the state change because if the statechange
        // is illegal, we need to throw an exception.  If this exception occurs, we do not want to
        // notify the cm of the tx started because we are not allowing it to start.
        // loop through the listeners
        for (int i = 0; i < numListeners; i++) {
            // send Local Transaction Started event to the current listener
            ivEventListeners[i].localTransactionStarted(connEvent); 
        }

        // Replace ConnectionEvent caching with a single reusable instance per
        // ManagedConnection. 

        if (isTraceOn && tc.isEntryEnabled()) 
        {
            Tr.exit(this, tc, "processLocalTransactionStartedEvent", handle);
        }

    }
1060756
public void localCommit()
    {
        if (log.isDebugEnabled()) log.debug("commit was called");
        if (!this.isInLocalTransaction)
        {
            throw new TransactionNotInProgressException("Not in transaction, call begin() before commit()");
        }
        try
        {
            if(!broker.isManaged())
            {
                if (batchCon != null)
                {
                    batchCon.commit();
                }
                else if (con != null)
                {
                    con.commit();
                }
            }
            else
            {
                if(log.isDebugEnabled()) log.debug(
                        "Found managed environment setting in PB, will skip Connection.commit() call");
            }
        }
        catch (SQLException e)
        {
            log.error("Commit on underlying connection failed, try to rollback connection", e);
            this.localRollback();
            throw new TransactionAbortedException("Commit on connection failed", e);
        }
        finally
        {
            this.isInLocalTransaction = false;
            restoreAutoCommitState();
            this.releaseConnection();
        }
    }
101967
public void setCommerceAccountLocalService(
		com.liferay.commerce.account.service.CommerceAccountLocalService commerceAccountLocalService) {
		this.commerceAccountLocalService = commerceAccountLocalService;
	}
1108479
@Reference(service=ClassLoadingService.class, name="classLoadingService")
    protected void setClassLoadingService(ServiceReference<ClassLoadingService> ref) {
        classLoadingSRRef.setReference(ref);
    }
1341377
@Override
	public void rollback() {
		Optional<LocalTransactionContext> txContext = currentTxContext();
		if (txContext.isPresent()) {
			txContext.get().rollback();
		} else {
			this.unmanagedTransaction.ifPresent(LocalTransactionContext::rollback);
		}
	}
199446
public boolean putReference(K key, ServiceReference<V> reference) {
        if (key == null || reference == null)
            return false;

        ConcurrentServiceReferenceElement<V> element = new ConcurrentServiceReferenceElement<V>(referenceName, reference);
        return (elementMap.put(key, element) != null);
    }
970745
@Reference(name = THREAD_CONTEXT_PROVIDER,
               service = ThreadContextProvider.class,
               cardinality = ReferenceCardinality.MULTIPLE,
               policy = ReferencePolicy.DYNAMIC,
               policyOption = ReferencePolicyOption.GREEDY)
    protected void setThreadContextProvider(ServiceReference<ThreadContextProvider> ref) {
        String threadContextProviderName = (String) ref.getProperty(COMPONENT_NAME);
        threadContextProviders.putReference(threadContextProviderName, ref);
        if (Boolean.TRUE.equals(ref.getProperty(ThreadContextProvider.ALWAYS_CAPTURE_THREAD_CONTEXT)))
            alwaysEnabled.add(threadContextProviderName);
    }
273445
protected void initChildOf(APMSpanBuilder builder, Reference ref) {
        APMSpan parent = (APMSpan) ref.getReferredTo();

        if (parent.getNodeBuilder() != null) {
            nodeBuilder = new NodeBuilder(parent.getNodeBuilder());
            traceContext = parent.traceContext;

            // As it is not possible to know if a tag has been set after span
            // creation, we use this situation to check if the parent span
            // has the 'transaction.name' specified, to set on the trace
            // context. This is required in case a child span is used to invoke
            // another service (and needs to propagate the transaction
            // name).
            if (parent.getTags().containsKey(Constants.PROP_TRANSACTION_NAME)
                    && traceContext.getTransaction() == null) {
                traceContext.setTransaction(
                        parent.getTags().get(Constants.PROP_TRANSACTION_NAME).toString());
            }
        }

        processRemainingReferences(builder, ref);
    }
467383
@Reference(name = BASE_INSTANCE,
               service = ContextService.class,
               cardinality = ReferenceCardinality.OPTIONAL,
               policy = ReferencePolicy.DYNAMIC,
               policyOption = ReferencePolicyOption.GREEDY,
               target = "(id=unbound)")
    protected void setBaseInstance(ServiceReference<ContextService> ref) {
        lock.writeLock().lock();
        try {
            threadContextConfigurations = null;
        } finally {
            lock.writeLock().unlock();
        }
    }
795889
@Reference(service = ApplicationTracker.class)
    protected void setApplicationTracker(ServiceReference<ApplicationTracker> ref) {
        appTrackerRef.setReference(ref);
    }
1308124
public boolean addReference(ServiceReference<T> reference) {
        if (reference == null)
            return false;

        ConcurrentServiceReferenceElement<T> element = new ConcurrentServiceReferenceElement<T>(referenceName, reference);

        synchronized (elementMap) {
            ConcurrentServiceReferenceElement<T> oldElement = elementMap.put(reference, element);
            if (oldElement != null) {
                if (!element.getRanking().equals(oldElement.getRanking())) {
                    elementSetUnsorted = true;
                }
                return true;
            }

            elementSet.add(element);
        }
        return false;
    }
1134266
protected void setDeferrableScheduledExecutor(ServiceReference<ScheduledExecutorService> ref) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "setDeferrableScheduledExecutor", ref);
        deferrableSchedXSvcRef.setReference(ref);
    }
1141606
public final void markAsWriteTransaction(GlobalTransaction globalTransaction, boolean local) {
      TransactionStatistics txs = getTransactionStatistic(globalTransaction, local);
      if (txs == null) {
         log.markUnexistingTransactionAsWriteTransaction(globalTransaction == null ? "null" : globalTransaction.globalId());
         return;
      }
      txs.markAsUpdateTransaction();
   }
580161
protected LocalTransactionWrapper getLocalTransactionWrapper(boolean rrsTransactional) throws ResourceException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "getLocalTransactionWrapper", rrsTransactional);
        }

        if (localTranWrapper == null) {
            localTranWrapper = new LocalTransactionWrapper(this);
        }

        // Move the localTranWrapper.initialize() call outside of the above "localTranWrapper == null"
        // conditional.  Prior to this change, the localTransaction within the localTranWrapper was not
        // getting re-initialized for MCWrappers that were pulled from the MCWrapperPool.  This
        // call to initialize() for existing localTranWrappers is safe and quick since we check
        // for an existing localTransaction as the first thing in initialize().
        //
        localTranWrapper.initialize();
        localTranWrapper.setRRSTransactional(rrsTransactional);
        tranWrapperInUse = LOCALTXWRAPPER;

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "getLocalTransactionWrapper");
        }

        return localTranWrapper;

    }
865138
@Reference(name = "contextService", service = WSContextService.class)
    protected void setContextService(ServiceReference<WSContextService> ref) {
        contextServiceRef.setReference(ref);
    }
392747
@Reference(service=SessionHelper.class, name="sessionHelper")
    protected void setSessionHelper(ServiceReference<SessionHelper> ref) {
        sessionHelperSRRef.setReference(ref);
    }