List of usage examples for org.springframework.transaction.support TransactionSynchronizationManager clear
public static void clear()
From source file:bigbank.transaction.DefaultSynchronizationManager.java
@Override public void clearSynchronization() { TransactionSynchronizationManager.clear(); }
From source file:com.becool.base.spring.tx.SpringTransactionSynchronizationManager.java
public void clearSynchronization() { TransactionSynchronizationManager.clear(); }
From source file:com.wavemaker.runtime.data.spring.SpringDataServiceManager.java
@Override public void commit() { if (txLogger.isInfoEnabled()) { txLogger.info("commit"); }/*w w w . j av a2s . co m*/ ThreadContext.Context ctx = ThreadContext.getContext(this.metaData.getName()); if (ctx == null) { if (txLogger.isWarnEnabled()) { txLogger.warn("ignoring commit - no tx in progress"); if (txLogger.isDebugEnabled()) { logStackTrace(); } } return; } TransactionStatus txStatus = ctx.getTransactionStatus(); try { if (txStatus == null) { if (txLogger.isWarnEnabled()) { txLogger.warn("ignoring commit - no tx status"); if (txLogger.isDebugEnabled()) { logStackTrace(); } } } else { this.txMgr.commit(txStatus); } } finally { ctx.setTransactionStatus(null); ThreadContext.unsetContext(this.metaData.getName()); HashMap<String, ThreadContext.Context> contextHash = ThreadContext.getThreadLocalHash(); if (contextHash != null && contextHash.size() > 0) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.initSynchronization(); } } else { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.clear(); Map map = TransactionSynchronizationManager.getResourceMap(); for (Object entry : map.keySet()) { TransactionSynchronizationManager.unbindResource(entry); } } } } }
From source file:org.springframework.transaction.support.AbstractPlatformTransactionManager.java
/** * Clean up after completion, clearing synchronization if necessary, * and invoking doCleanupAfterCompletion. * @param status object representing the transaction * @see #doCleanupAfterCompletion/* w ww .jav a 2 s . c o m*/ */ private void cleanupAfterCompletion(DefaultTransactionStatus status) { status.setCompleted(); if (status.isNewSynchronization()) { TransactionSynchronizationManager.clear(); } if (status.isNewTransaction()) { doCleanupAfterCompletion(status.getTransaction()); } if (status.getSuspendedResources() != null) { if (status.isDebug()) { logger.debug("Resuming suspended transaction after completion of inner transaction"); } Object transaction = (status.hasTransaction() ? status.getTransaction() : null); resume(transaction, (SuspendedResourcesHolder) status.getSuspendedResources()); } }