@Override public void afterCompletion(int status) { TransactionSynchronizationManager.unbindResourceIfPossible(SimpleTransactionScope.this); for (Runnable callback : this.scopedObjects.destructionCallbacks.values()) { callback.run(); } this.scopedObjects.destructionCallbacks.clear(); this.scopedObjects.scopedInstances.clear(); } }
@Override public void afterCompletion(int status) { TransactionSynchronizationManager.unbindResourceIfPossible(SimpleTransactionScope.this); for (Runnable callback : this.scopedObjects.destructionCallbacks.values()) { callback.run(); } this.scopedObjects.destructionCallbacks.clear(); this.scopedObjects.scopedInstances.clear(); } }
@Override protected void doCleanupAfterCompletion(Object transaction) { TransactionSynchronizationManager.unbindResourceIfPossible(redisson); RedissonTransactionObject to = (RedissonTransactionObject) transaction; to.getTransactionHolder().setTransaction(null); }
@Override protected void doCleanupAfterCompletion(Object transaction) { TransactionSynchronizationManager.unbindResourceIfPossible(redisson); RedissonTransactionObject to = (RedissonTransactionObject) transaction; to.getTransactionHolder().setTransaction(null); }
/** * Unbinds and closes the connection (if any) associated with the given factory. * * @param factory Redis factory */ public static void unbindConnection(RedisConnectionFactory factory) { RedisConnectionHolder connHolder = (RedisConnectionHolder) TransactionSynchronizationManager .unbindResourceIfPossible(factory); if (connHolder == null) { return; } if (connHolder.isTransactionSyncronisationActive()) { if (log.isDebugEnabled()) { log.debug("Redis Connection will be closed when outer transaction finished."); } } else { if (log.isDebugEnabled()) { log.debug("Closing bound connection."); } RedisConnection connection = connHolder.getConnection(); connection.close(); } }
@Override public void afterCompletion(int status) { // If we haven't closed the Connection in beforeCompletion, // close it now. The holder might have been used for other // cleanup in the meantime, for example by a Hibernate Session. if (this.holderActive) { // The thread-bound ConnectionHolder might not be available anymore, // since afterCompletion might get called from a different thread. TransactionSynchronizationManager.unbindResourceIfPossible(this.dataSource); this.holderActive = false; if (this.connectionHolder.hasConnection()) { releaseConnection(this.connectionHolder.getConnection(), this.dataSource); // Reset the ConnectionHolder: It might remain bound to the thread. this.connectionHolder.setConnection(null); } } this.connectionHolder.reset(); } }
@Override public void afterCompletion(int status) { if (shouldUnbindAtCompletion()) { boolean releaseNecessary = false; if (this.holderActive) { // The thread-bound resource holder might not be available anymore, // since afterCompletion might get called from a different thread. this.holderActive = false; TransactionSynchronizationManager.unbindResourceIfPossible(this.resourceKey); this.resourceHolder.unbound(); releaseNecessary = true; } else { releaseNecessary = shouldReleaseAfterCompletion(this.resourceHolder); } if (releaseNecessary) { releaseResource(this.resourceHolder, this.resourceKey); } } else { // Probably a pre-bound resource... cleanupResource(this.resourceHolder, this.resourceKey, (status == STATUS_COMMITTED)); } this.resourceHolder.reset(); }
TransactionSynchronizationManager.unbindResourceIfPossible(obtainEntityManagerFactory());
@Override public void afterCompletion(int status) { if (shouldUnbindAtCompletion()) { boolean releaseNecessary = false; if (this.holderActive) { // The thread-bound resource holder might not be available anymore, // since afterCompletion might get called from a different thread. this.holderActive = false; TransactionSynchronizationManager.unbindResourceIfPossible(this.resourceKey); this.resourceHolder.unbound(); releaseNecessary = true; } else { releaseNecessary = shouldReleaseAfterCompletion(this.resourceHolder); } if (releaseNecessary) { releaseResource(this.resourceHolder, this.resourceKey); } } else { // Probably a pre-bound resource... cleanupResource(this.resourceHolder, this.resourceKey, (status == STATUS_COMMITTED)); } this.resourceHolder.reset(); }
TransactionSynchronizationManager.unbindResourceIfPossible(obtainEntityManagerFactory());
@Override protected void doCleanupAfterCompletion(Object transaction) { Neo4jTransactionObject txObject = (Neo4jTransactionObject) transaction; // Remove the session holder from the thread, if still there. if (txObject.isNewSessionHolder()) { TransactionSynchronizationManager.unbindResourceIfPossible(getSessionFactory()); } Transaction rawTransaction = txObject.getTransactionData(); if (rawTransaction != null && rawTransaction.status().equals(Transaction.Status.OPEN)) { rawTransaction.close(); } // Remove the session holder from the thread. if (txObject.isNewSessionHolder()) { Session session = txObject.getSessionHolder().getSession(); if (logger.isDebugEnabled()) { logger.debug("Closing Neo4j Session [" + session + "] after transaction"); } // close session. SessionFactoryUtils.closeSession(session); } else { logger.debug("Not closing pre-bound Neo4j Session after transaction"); } txObject.getSessionHolder().clear(); }
@Override public void afterCompletion(int status) { TransactionSynchronizationManager.unbindResourceIfPossible(SimpleTransactionScope.this); for (Runnable callback : this.scopedObjects.destructionCallbacks.values()) { callback.run(); } this.scopedObjects.destructionCallbacks.clear(); this.scopedObjects.scopedInstances.clear(); } }
@Override public void afterCompletion(int status) { TransactionSynchronizationManager.unbindResourceIfPossible(SimpleTransactionScope.this); for (Runnable callback : this.scopedObjects.destructionCallbacks.values()) { callback.run(); } this.scopedObjects.destructionCallbacks.clear(); this.scopedObjects.scopedInstances.clear(); } }
private void stopTransactionSynchronization() { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.unbindResourceIfPossible(JMS_RESOURCE_KEY); } }
@Override protected void doCleanupAfterCompletion(Object transaction) { TransactionSynchronizationManager.unbindResourceIfPossible(redisson); RedissonTransactionObject to = (RedissonTransactionObject) transaction; to.getTransactionHolder().setTransaction(null); }
private void clearTransactionInfo() { ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(this); if (conHolder != null && conHolder. isSynchronizedWithTransaction()) { TransactionSynchronizationManager.unbindResourceIfPossible(this); } }
@Override protected void doCleanupAfterCompletion(Object transaction) { MolgenisTransaction molgenisTransaction = (MolgenisTransaction) transaction; if (LOG.isDebugEnabled()) { LOG.debug("Cleanup transaction [{}]", molgenisTransaction.getId()); } super.doCleanupAfterCompletion(molgenisTransaction.getDataSourceTransaction()); TransactionSynchronizationManager.unbindResourceIfPossible(TRANSACTION_ID_RESOURCE_NAME); transactionListeners.forEach(j -> j.doCleanupAfterCompletion(molgenisTransaction.getId())); }
@Override protected void doCleanupAfterCompletion(Object transaction) { HazelcastTransactionObject txObject = (HazelcastTransactionObject) transaction; if (txObject.isNewTransactionContextHolder()) { TransactionSynchronizationManager.unbindResourceIfPossible(hazelcastInstance); } txObject.getTransactionContextHolder().clear(); }
@Override protected void doCleanupAfterCompletion(Object transaction) { HazelcastTransactionObject txObject = (HazelcastTransactionObject) transaction; if (txObject.isNewTransactionContextHolder()) { TransactionSynchronizationManager.unbindResourceIfPossible(hazelcastInstance); } txObject.getTransactionContextHolder().clear(); }
@Override public void unbindResource() { EntityManagerHolder entityManagerHolder = (EntityManagerHolder) TransactionSynchronizationManager.unbindResourceIfPossible(transactionManager.getEntityManagerFactory()); EntityManagerFactoryUtils.closeEntityManager(entityManagerHolder.getEntityManager()); }