Package bitronix.tm.internal

Examples of bitronix.tm.internal.ThreadContext


        BitronixTransaction currentTx = getCurrentTransaction();
        if (currentTx != null)
            throw new NotSupportedException("nested transactions not supported");
        currentTx = createTransaction();

        ThreadContext threadContext = ThreadContext.getThreadContext();
        ClearContextSynchronization clearContextSynchronization = new ClearContextSynchronization(currentTx, threadContext);
        try {
            currentTx.getSynchronizationScheduler().add(clearContextSynchronization, Scheduler.ALWAYS_LAST_POSITION -1);
            currentTx.setActive(threadContext.getTimeout());
            inFlightTransactions.put(currentTx, clearContextSynchronization);
            if (log.isDebugEnabled()) { log.debug("begun new transaction at " + new Date(currentTx.getResourceManager().getGtrid().extractTimestamp())); }
        } catch (RuntimeException ex) {
            clearContextSynchronization.afterCompletion(Status.STATUS_NO_TRANSACTION);
            throw ex;
View Full Code Here


            throw new IllegalStateException("a transaction is already running on this thread");

        try {
            XAResourceManager resourceManager = tx.getResourceManager();
            resourceManager.resume();
            ThreadContext threadContext = ThreadContext.getThreadContext();
            threadContext.setTransaction(tx);
            inFlightTransactions.get(tx).setThreadContext(threadContext);
            MDC.put(MDC_GTRID_KEY, tx.getGtrid());
        } catch (XAException ex) {
            String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
            throw new BitronixSystemException("cannot resume " + tx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) +
View Full Code Here

        public void beforeCompletion() {
        }

        public void afterCompletion(int status) {
          ThreadContext context = threadContext.get();
          if (context != null) {
              if (log.isDebugEnabled()) { log.debug("clearing transaction from thread context: " + context); }
              context.clearTransaction();
          }
          else {
            if (log.isDebugEnabled()) { log.debug("thread context was null when clear context synchronization executed"); }
          }
            if (log.isDebugEnabled()) { log.debug("removing transaction from in-flight transactions: " + currentTx); }
View Full Code Here

TOP

Related Classes of bitronix.tm.internal.ThreadContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.