/** * Bind a new context on the current thread. * @param context the context to bind. */ private void setCurrentContext(ThreadContext context) { if (log.isDebugEnabled()) log.debug("changing current thread context to " + context); if (context == null) throw new IllegalArgumentException("setCurrentContext() should not be called with a null context, clearCurrentContextForSuspension() should be used instead"); contexts.put(Thread.currentThread(), context); if (context.getTransaction() != null) { MDC.put(MDC_GTRID_KEY, context.getTransaction().getGtrid()); } }
/** * Get the transaction currently registered on the current thread context. * @return the current transaction or null if no transaction has been started on the current thread. */ public BitronixTransaction getCurrentTransaction() { if (contexts.get(Thread.currentThread()) == null) return null; return getOrCreateCurrentContext().getTransaction(); }
/** * Bind a new context on the current thread. * @param context the context to bind. */ private void setCurrentContext(ThreadContext context) { if (log.isDebugEnabled()) log.debug("changing current thread context to " + context); if (context == null) throw new IllegalArgumentException("setCurrentContext() should not be called with a null context, clearCurrentContextForSuspension() should be used instead"); contexts.put(Thread.currentThread(), context); if (context.getTransaction() != null) { MDC.put(MDC_GTRID_KEY, context.getTransaction().getGtrid()); } }
/** * Get the transaction currently registered on the current thread context. * @return the current transaction or null if no transaction has been started on the current thread. */ public BitronixTransaction getCurrentTransaction() { return ThreadContext.getThreadContext().getTransaction(); }
/** * Get the transaction currently registered on the current thread context. * @return the current transaction or null if no transaction has been started on the current thread. */ public BitronixTransaction getCurrentTransaction() { if (contexts.get(Thread.currentThread()) == null) return null; return getOrCreateCurrentContext().getTransaction(); }
/** * Get the transaction currently registered on the current thread context. * @return the current transaction or null if no transaction has been started on the current thread. */ public BitronixTransaction getCurrentTransaction() { return ThreadContext.getThreadContext().getTransaction(); }
public void afterCompletion(int status) { Iterator<Map.Entry<Thread, ThreadContext>> it = contexts.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Thread, ThreadContext> entry = it.next(); ThreadContext context = entry.getValue(); if (context.getTransaction() == currentTx) { if (log.isDebugEnabled()) log.debug("clearing thread context: " + context); it.remove(); break; } } inFlightTransactions.remove(currentTx.getResourceManager().getGtrid()); MDC.remove(MDC_GTRID_KEY); }
public void afterCompletion(int status) { Iterator<Map.Entry<Thread, ThreadContext>> it = contexts.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Thread, ThreadContext> entry = it.next(); ThreadContext context = entry.getValue(); if (context.getTransaction() == currentTx) { if (log.isDebugEnabled()) log.debug("clearing thread context: " + context); it.remove(); break; } } inFlightTransactions.remove(currentTx.getResourceManager().getGtrid()); MDC.remove(MDC_GTRID_KEY); }