public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) { stack = new TransactionEnlistingInterceptor(stack, transactionManager); return new TransactionCachingInterceptor(stack, transactionManager); }
public void afterCompletion(Object stuff) { ManagedConnectionInfos managedConnectionInfos = (ManagedConnectionInfos) stuff; ManagedConnectionInfo sharedMCI = managedConnectionInfos.getShared(); if (sharedMCI != null) { if (log.isTraceEnabled()) { log.trace("Transaction completed, attempting to return shared connection MCI: " + infoString(sharedMCI)); } returnHandle(sharedMCI); } for (ManagedConnectionInfo managedConnectionInfo : managedConnectionInfos.getUnshared()) { if (log.isTraceEnabled()) { log.trace("Transaction completed, attempting to return unshared connection MCI: " + infoString(managedConnectionInfo)); } returnHandle(managedConnectionInfo); } }
log.trace("destroying connection " + infoString(connectionInfo)); if (TxUtil.isActive(transaction)) { if (log.isTraceEnabled()) { log.trace("tx active, not returning connection " + infoString(connectionInfo)); managedConnectionInfos.remove(connectionInfo.getManagedConnectionInfo()); if (log.isTraceEnabled()) { log.trace("tx ended, return during synchronization afterCompletion " + infoString(connectionInfo)); log.trace("tx ended, returning connection " + infoString(connectionInfo)); internalReturn(connectionInfo, connectionReturnAction);
private void internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) { if (connectionInfo.getManagedConnectionInfo().hasConnectionHandles()) { if (log.isTraceEnabled()) { log.trace("not returning connection from tx cache (has handles) " + infoString(connectionInfo)); } return; } //No transaction, no handles, we return it. next.returnConnection(connectionInfo, connectionReturnAction); if (log.isTraceEnabled()) { log.trace("completed return of connection through tx cache " + infoString(connectionInfo)); } }
private void returnHandle(ManagedConnectionInfo managedConnectionInfo) { ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.setManagedConnectionInfo(managedConnectionInfo); internalReturn(connectionInfo, ConnectionReturnAction.RETURN_HANDLE); }
managedConnectionInfos.addUnshared(connectionInfo.getManagedConnectionInfo()); if (log.isTraceEnabled()) { log.trace("Enlisting connection already associated with handle " + infoString(connectionInfo)); managedConnectionInfos.addUnshared(previousMci); if (log.isTraceEnabled()) { log.trace("Enlisting existing connection associated with connection handle with current tx " + infoString(connectionInfo)); log.trace("supplying connection from tx cache " + infoString(connectionInfo));
public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) { stack = new TransactionEnlistingInterceptor(stack, transactionManager); return new TransactionCachingInterceptor(stack, transactionManager); }
public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack, TransactionManager transactionManager) { //experimental thread local caching if (isUseThreadCaching()) { //useMatching should be configurable stack = new ThreadLocalCachingConnectionInterceptor(stack, false); } stack = new TransactionEnlistingInterceptor(stack, transactionManager); if (isUseTransactionCaching()) { stack = new TransactionCachingInterceptor(stack, transactionManager); } return stack; }