From scm-return-43808-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Wed Aug 11 16:51:16 2010 Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 7115 invoked from network); 11 Aug 2010 16:51:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Aug 2010 16:51:14 -0000 Received: (qmail 60773 invoked by uid 500); 11 Aug 2010 16:51:14 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 60653 invoked by uid 500); 11 Aug 2010 16:51:13 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 60646 invoked by uid 99); 11 Aug 2010 16:51:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Aug 2010 16:51:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Aug 2010 16:51:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4A83923888DD; Wed, 11 Aug 2010 16:49:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r984469 - in /geronimo/components/txmanager/trunk: ./ geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/ geronimo-connector/src/te... Date: Wed, 11 Aug 2010 16:49:47 -0000 To: scm@geronimo.apache.org From: djencks@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100811164948.4A83923888DD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: djencks Date: Wed Aug 11 16:49:47 2010 New Revision: 984469 URL: http://svn.apache.org/viewvc?rev=984469&view=rev Log: Logging improvements from branches/2.1 rev 984259 Modified: geronimo/components/txmanager/trunk/ (props changed) geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SubjectInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TCCLInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/LogXAResourceInsertionInterceptor.java geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolTest.java geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionInterceptorTestUtils.java geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/log/XidImpl2.java geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidImpl.java Propchange: geronimo/components/txmanager/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Aug 11 16:49:47 2010 @@ -1 +1 @@ -/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.1:780438-803185 +/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.1:780438-803185,984259 Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -44,7 +44,7 @@ public abstract class AbstractSinglePool protected Semaphore permits; protected int blockingTimeoutMilliseconds; protected int connectionCount = 0; - private long idleTimeoutMilliseconds; + protected long idleTimeoutMilliseconds; private IdleReleaser idleReleaser; protected Timer timer = PoolIdleReleaserTimer.getTimer(); protected int maxSize = 0; @@ -68,7 +68,7 @@ public abstract class AbstractSinglePool public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { if (connectionInfo.getManagedConnectionInfo().getManagedConnection() != null) { if (log.isTraceEnabled()) { - log.trace("using already assigned connection " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to pool " + this); + log.trace("supplying already assigned connection from pool " + this + " " + connectionInfo); } return; } @@ -103,7 +103,7 @@ public abstract class AbstractSinglePool public void returnConnection(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) { if (log.isTraceEnabled()) { - log.trace("returning connection " + connectionInfo.getConnectionHandle() + " for MCI " + connectionInfo.getManagedConnectionInfo() + " to pool " + this); + log.trace("returning connection " + connectionInfo.getConnectionHandle() + " for MCI " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to pool " + this); } // not strictly synchronized with destroy(), but pooled operations in internalReturn() are... @@ -120,7 +120,9 @@ public abstract class AbstractSinglePool try { ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo(); if (connectionReturnAction == ConnectionReturnAction.RETURN_HANDLE && mci.hasConnectionHandles()) { - log.warn("Return request at pool with connection handles! " + connectionInfo.getConnectionHandle() + " for MCI " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to pool " + this, new Exception("Stack trace")); + if (log.isTraceEnabled()) { + log.trace("Return request at pool with connection handles! " + connectionInfo.getConnectionHandle() + " for MCI " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to pool " + this, new Exception("Stack trace")); + } return; } @@ -177,6 +179,9 @@ public abstract class AbstractSinglePool } } //we must destroy connection. + if (log.isTraceEnabled()) { + log.trace("Discarding connection in pool " + this + " " + connectionInfo); + } next.returnConnection(connectionInfo, connectionReturnAction); connectionCount--; return releasePermit; Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java Wed Aug 11 16:49:47 2010 @@ -74,4 +74,13 @@ public class ConnectionHandleInterceptor public void destroy() { next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("\n"); + if (next == null) { + s.append(""); + } else { + next.info(s); + } + } } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java Wed Aug 11 16:49:47 2010 @@ -123,6 +123,11 @@ public class ConnectionInfo { return trace; } - - + @Override + public String toString() { + StringBuilder b = new StringBuilder(); + b.append("handle: ").append(connection); + b.append(mci); + return b.toString(); + } } // ConnectionInfo Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -36,4 +36,6 @@ public interface ConnectionInterceptor { void destroy(); + void info(StringBuilder s); + } // ConnectionInterceptor Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java Wed Aug 11 16:49:47 2010 @@ -123,4 +123,14 @@ public class ConnectionTrackingIntercept } } } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[key=").append(key).append("]\n"); + if (next == null) { + s.append(""); + } else { + next.info(s); + } + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java Wed Aug 11 16:49:47 2010 @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; * @version $Rev$ $Date$ */ public class GenericConnectionManager extends AbstractConnectionManager { - protected static final Logger log = LoggerFactory.getLogger(AbstractSinglePoolConnectionInterceptor.class); + protected static final Logger log = LoggerFactory.getLogger(GenericConnectionManager.class); //default constructor to support externalizable subclasses public GenericConnectionManager() { @@ -155,6 +155,11 @@ public class GenericConnectionManager ex } tail.setStack(stack); this.stack = stack; + if (log.isDebugEnabled()) { + StringBuilder s = new StringBuilder("ConnectionManager Interceptor stack;\n"); + stack.info(s); + log.debug(s.toString()); + } } public ConnectionInterceptor getStack() { Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -53,4 +53,14 @@ public class LocalXAResourceInsertionInt public void destroy() { next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[name=").append(name).append("]\n"); + if (next == null) { + s.append(""); + } else { + next.info(s); + } + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -82,4 +82,9 @@ public class MCFConnectionInterceptor im this.stack = stack; } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[stack=").append(stack).append("]\n"); + s.append(""); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -166,6 +166,12 @@ public class MultiPoolConnectionIntercep } } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[useSubject=").append(useSubject).append(",useCRI=").append(useCRI).append(",pool count=").append(pools.size()).append("]\n"); + next.info(s); + } + + static class SubjectCRIKey { private final Subject subject; private final ConnectionRequestInfo cri; Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -69,7 +69,7 @@ public class SinglePoolConnectionInterce next.getConnection(connectionInfo); connectionCount++; if (log.isTraceEnabled()) { - log.trace("Supplying new connection MCI: " + connectionInfo.getManagedConnectionInfo() + " from pool: " + this); + log.trace("Supplying new connection MCI: " + connectionInfo.getManagedConnectionInfo() + " MC: " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " from pool: " + this); } return; } else { @@ -81,7 +81,7 @@ public class SinglePoolConnectionInterce if (selectOneAssumeMatch) { connectionInfo.setManagedConnectionInfo(newMCI); if (log.isTraceEnabled()) { - log.trace("Supplying pooled connection without checking matching MCI: " + connectionInfo.getManagedConnectionInfo() + " from pool: " + this); + log.trace("Supplying pooled connection without checking matching MCI: " + connectionInfo.getManagedConnectionInfo() + " MC: " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " from pool: " + this); } return; } @@ -168,4 +168,14 @@ public class SinglePoolConnectionInterce } } + public void info(StringBuilder s) { + s.append(getClass().getName()); + s.append("[minSize=").append(minSize); + s.append(",maxSize=").append(maxSize); + s.append(",idleTimeoutMilliseconds=").append(idleTimeoutMilliseconds); + s.append(",blockingTimeoutMilliseconds=").append(blockingTimeoutMilliseconds); + s.append(".selectOneAssumeMatch=").append(selectOneAssumeMatch).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -67,7 +67,7 @@ public class SinglePoolMatchAllConnectio connectionInfo.setManagedConnectionInfo(pool.get(matchedMC)); pool.remove(matchedMC); if (log.isTraceEnabled()) { - log.trace("Returning pooled connection " + connectionInfo.getManagedConnectionInfo()); + log.trace("Supplying existing connection from pool " + this + " " + connectionInfo); } if (connectionCount < minSize) { timer.schedule(new FillTask(connectionInfo), 10); @@ -78,6 +78,7 @@ public class SinglePoolMatchAllConnectio //matching failed or pool is empty //if pool is at maximum size, pick a cx to kill if (connectionCount == maxSize) { + log.trace("Pool is at max size but no connections match, picking one to destroy"); Iterator iterator = pool.entrySet().iterator(); ManagedConnectionInfo kill = (ManagedConnectionInfo) ((Map.Entry) iterator.next()).getValue(); iterator.remove(); @@ -87,7 +88,7 @@ public class SinglePoolMatchAllConnectio next.getConnection(connectionInfo); connectionCount++; if (log.isTraceEnabled()) { - log.trace("Returning new connection " + connectionInfo.getManagedConnectionInfo()); + log.trace("Supplying new connection from pool " + this + " " + connectionInfo); } if (connectionCount < minSize) { timer.schedule(new FillTask(connectionInfo), 10); @@ -148,4 +149,13 @@ public class SinglePoolMatchAllConnectio } + public void info(StringBuilder s) { + s.append(getClass().getName()); + s.append("[minSize=").append(minSize); + s.append(",maxSize=").append(maxSize); + s.append(",idleTimeoutMilliseconds=").append(idleTimeoutMilliseconds); + s.append(",blockingTimeoutMilliseconds=").append(blockingTimeoutMilliseconds).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SubjectInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SubjectInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SubjectInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SubjectInterceptor.java Wed Aug 11 16:49:47 2010 @@ -99,4 +99,9 @@ public class SubjectInterceptor implemen next.destroy(); } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[subjectSource=").append(subjectSource).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TCCLInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TCCLInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TCCLInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TCCLInterceptor.java Wed Aug 11 16:49:47 2010 @@ -56,4 +56,10 @@ public class TCCLInterceptor implements public void destroy() { this.next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[classLoader=").append(classLoader).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -85,4 +85,10 @@ public class ThreadLocalCachingConnectio public void destroy() { next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[matchConnections=").append(matchConnections).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java Wed Aug 11 16:49:47 2010 @@ -65,7 +65,7 @@ public class TransactionCachingIntercept //There can be an inactive transaction context when a connection is requested in //Synchronization.afterCompletion(). - // get the current transation and status... if there is a problem just assume there is no transaction present + // get the current transaction and status... if there is a problem just assume there is no transaction present Transaction transaction = TxUtil.getTransactionIfActive(transactionManager); if (transaction != null) { ManagedConnectionInfos managedConnectionInfos = ConnectorTransactionContext.get(transaction, this); @@ -73,6 +73,9 @@ public class TransactionCachingIntercept if (!managedConnectionInfos.containsUnshared(connectionInfo.getManagedConnectionInfo())) { next.getConnection(connectionInfo); managedConnectionInfos.addUnshared(connectionInfo.getManagedConnectionInfo()); + if (log.isTraceEnabled()) { + log.trace("Enlisting connection already associated with handle " + infoString(connectionInfo)); + } } } else { ManagedConnectionInfo managedConnectionInfo = managedConnectionInfos.getShared(); @@ -83,12 +86,15 @@ public class TransactionCachingIntercept //enlists connection next.getConnection(connectionInfo); managedConnectionInfos.addUnshared(previousMci); + if (log.isTraceEnabled()) { + log.trace("Enlisting existing connection associated with connection handle with current tx " + infoString(connectionInfo)); + } } else { connectionInfo.setManagedConnectionInfo(managedConnectionInfo); //return; if (log.isTraceEnabled()) { - log.trace("supplying connection from tx cache " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + log.trace("supplying connection from tx cache " + infoString(connectionInfo)); } } } else { @@ -108,7 +114,7 @@ public class TransactionCachingIntercept if (connectionReturnAction == ConnectionReturnAction.DESTROY) { if (log.isTraceEnabled()) { - log.trace("destroying connection" + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + log.trace("destroying connection " + infoString(connectionInfo)); } next.returnConnection(connectionInfo, connectionReturnAction); return; @@ -119,7 +125,7 @@ public class TransactionCachingIntercept if (transaction != null) { if (TxUtil.isActive(transaction)) { if (log.isTraceEnabled()) { - log.trace("tx active, not returning connection" + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + log.trace("tx active, not returning connection " + infoString(connectionInfo)); } return; } @@ -128,14 +134,14 @@ public class TransactionCachingIntercept ManagedConnectionInfos managedConnectionInfos = ConnectorTransactionContext.get(transaction, this); managedConnectionInfos.remove(connectionInfo.getManagedConnectionInfo()); if (log.isTraceEnabled()) { - log.trace("tx ended, but not removed"); + log.trace("tx ended, return during synchronization afterCompletion " + infoString(connectionInfo)); } } } catch (SystemException e) { //ignore } if (log.isTraceEnabled()) { - log.trace("tx ended, returning connection" + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + log.trace("tx ended, returning connection " + infoString(connectionInfo)); } internalReturn(connectionInfo, connectionReturnAction); } @@ -143,14 +149,14 @@ public class TransactionCachingIntercept private void internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) { if (connectionInfo.getManagedConnectionInfo().hasConnectionHandles()) { if (log.isTraceEnabled()) { - log.trace("not returning connection from tx cache (has handles) " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + 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 " + connectionInfo.getConnectionHandle() + " for MCI: " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this); + log.trace("completed return of connection through tx cache " + infoString(connectionInfo)); } } @@ -163,13 +169,13 @@ public class TransactionCachingIntercept ManagedConnectionInfo sharedMCI = managedConnectionInfos.getShared(); if (sharedMCI != null) { if (log.isTraceEnabled()) { - log.trace("Transaction completed, attempting to return shared connection MCI: " + sharedMCI + " for managed connection " + sharedMCI.getManagedConnection() + " to tx caching interceptor " + this); + 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: " + managedConnectionInfo + " for managed connection " + managedConnectionInfo.getManagedConnection() + " to tx caching interceptor " + this); + log.trace("Transaction completed, attempting to return unshared connection MCI: " + infoString(managedConnectionInfo)); } returnHandle(managedConnectionInfo); } @@ -181,6 +187,15 @@ public class TransactionCachingIntercept internalReturn(connectionInfo, ConnectionReturnAction.RETURN_HANDLE); } + private String infoString(Object connectionInfo) { + return "for tx caching interceptor " + this + " " + connectionInfo; + } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[transactionManager=").append(transactionManager).append("]\n"); + next.info(s); + } + public static class ManagedConnectionInfos { private ManagedConnectionInfo shared; private Set unshared = new HashSet(1); Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java Wed Aug 11 16:49:47 2010 @@ -23,6 +23,8 @@ import javax.transaction.SystemException import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.xa.XAResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * TransactionEnlistingInterceptor.java @@ -33,6 +35,7 @@ import javax.transaction.xa.XAResource; * @version 1.0 */ public class TransactionEnlistingInterceptor implements ConnectionInterceptor { + protected static Logger log = LoggerFactory.getLogger(TransactionEnlistingInterceptor.class); private final ConnectionInterceptor next; private final TransactionManager transactionManager; @@ -51,7 +54,14 @@ public class TransactionEnlistingInterce Transaction transaction = TxUtil.getTransactionIfActive(transactionManager); if (transaction != null) { XAResource xares = mci.getXAResource(); + if (log.isTraceEnabled()) { + log.trace("Enlisting connection " + connectionInfo + " with XAResource " + xares + " in transaction: " + transaction); + } transaction.enlistResource(xares); + } else { + if (log.isTraceEnabled()) { + log.trace("not enlisting connection " + connectionInfo + " with XAResource " + mci.getXAResource() + " no transaction"); + } } } catch (SystemException e) { returnConnection(connectionInfo, ConnectionReturnAction.DESTROY); @@ -82,11 +92,19 @@ public class TransactionEnlistingInterce Transaction transaction = TxUtil.getTransactionIfActive(transactionManager); if (transaction != null) { XAResource xares = mci.getXAResource(); + if (log.isTraceEnabled()) { + log.trace("Delisting connection " + connectionInfo + " with XAResource " + xares + " in transaction: " + transaction, new Exception("stack trace")); + } transaction.delistResource(xares, XAResource.TMSUSPEND); + } else { + if (log.isTraceEnabled()) { + log.trace("not delisting connection " + connectionInfo + " with XAResource " + mci.getXAResource() + " no transaction"); + } } } catch (SystemException e) { //maybe we should warn??? + log.info("Could not delist resource: " + connectionInfo + " with XAResource: " + connectionInfo.getManagedConnectionInfo().getXAResource(), e); connectionReturnAction = ConnectionReturnAction.DESTROY; } catch (IllegalStateException e) { connectionReturnAction = ConnectionReturnAction.DESTROY; @@ -99,4 +117,9 @@ public class TransactionEnlistingInterce next.destroy(); } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[transactionManager=").append(transactionManager).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -51,4 +51,9 @@ public class XAResourceInsertionIntercep next.destroy(); } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[name=").append(name).append("]\n"); + next.info(s); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/LogXAResourceInsertionInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/LogXAResourceInsertionInterceptor.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/LogXAResourceInsertionInterceptor.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/LogXAResourceInsertionInterceptor.java Wed Aug 11 16:49:47 2010 @@ -59,4 +59,14 @@ public class LogXAResourceInsertionInter public void destroy() { next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("[name=").append(name).append("]\n"); + if (next == null) { + s.append(""); + } else { + next.info(s); + } + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolTest.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolTest.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolTest.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolTest.java Wed Aug 11 16:49:47 2010 @@ -30,7 +30,7 @@ import junit.framework.TestCase; import org.apache.geronimo.connector.mock.MockManagedConnectionFactory; /** - * @version $Rev:$ $Date:$ + * @version $Rev$ $Date$ */ public class AbstractSinglePoolTest extends TestCase { @@ -268,5 +268,11 @@ public class AbstractSinglePoolTest exte public void destroy() { next.destroy(); } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("\n"); + next.info(s); + } + } } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionInterceptorTestUtils.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionInterceptorTestUtils.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionInterceptorTestUtils.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionInterceptorTestUtils.java Wed Aug 11 16:49:47 2010 @@ -183,4 +183,9 @@ public class ConnectionInterceptorTestUt } } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("\n"); + s.append(""); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java Wed Aug 11 16:49:47 2010 @@ -276,6 +276,10 @@ public class ConnectionTrackingCoordinat public void destroy() { } + public void info(StringBuilder s) { + s.append(getClass().getName()).append("\n"); + } + private ConnectionInfo createConnectionInfo() { ConnectionInfo ci = new ConnectionInfo(mci); ci.setConnectionHandle(connection); Modified: geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java (original) +++ geronimo/components/txmanager/trunk/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java Wed Aug 11 16:49:47 2010 @@ -166,4 +166,10 @@ public class ConnectionTrackingCoordinat public void destroy() { } + + public void info(StringBuilder s) { + s.append(getClass().getName()).append("\n"); + s.append(""); + } + } Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/log/XidImpl2.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/log/XidImpl2.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/log/XidImpl2.java (original) +++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/log/XidImpl2.java Wed Aug 11 16:49:47 2010 @@ -53,6 +53,16 @@ public class XidImpl2 implements Xid, Se System.arraycopy(globalId, 0, buffer, HEADER_SIZE + FORMAT_SIZE, Xid.MAXGTRIDSIZE); //this.hash = hash(buffer); + check(); + } + + private void check() { + if (buffer[GLOBALID_SIZE_POS] > Xid.MAXGTRIDSIZE) { + throw new IllegalStateException("Global ID too large: " + buffer[GLOBALID_SIZE_POS]); + } + if (buffer[BRANCHID_SIZE_POS] > Xid.MAXBQUALSIZE) { + throw new IllegalStateException("Branch ID too large: " + buffer[GLOBALID_SIZE_POS]); + } } /** @@ -71,6 +81,7 @@ public class XidImpl2 implements Xid, Se buffer[BRANCHID_SIZE_POS] = (byte) branch.length; System.arraycopy(branch, 0, buffer, HEADER_SIZE + FORMAT_SIZE + Xid.MAXGTRIDSIZE, Xid.MAXBQUALSIZE); //hash = hash(buffer); + check(); } public XidImpl2(int formatId, byte[] globalId, byte[] branch) { @@ -80,6 +91,7 @@ public class XidImpl2 implements Xid, Se buffer[BRANCHID_SIZE_POS] = (byte) branch.length; System.arraycopy(branch, 0, buffer, HEADER_SIZE + FORMAT_SIZE + Xid.MAXGTRIDSIZE, Xid.MAXBQUALSIZE); //hash = hash(buffer); + check(); } private int hash(byte[] id) { @@ -122,7 +134,7 @@ public class XidImpl2 implements Xid, Se } public String toString() { - StringBuffer s = new StringBuffer("[formatId=Gero,"); + StringBuffer s = new StringBuffer("[XidImpl2:formatId=Gero,"); s.append("globalId="); for (int i = FORMAT_SIZE; i < FORMAT_SIZE + Xid.MAXGTRIDSIZE; i++) { s.append(Integer.toHexString(buffer[i])); Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidImpl.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidImpl.java?rev=984469&r1=984468&r2=984469&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidImpl.java (original) +++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidImpl.java Wed Aug 11 16:49:47 2010 @@ -42,6 +42,16 @@ public class XidImpl implements Xid, Ser this.globalId = globalId; //this.hash = hash(0, globalId); branchId = new byte[Xid.MAXBQUALSIZE]; + check(); + } + + private void check() { + if (globalId.length > Xid.MAXGTRIDSIZE) { + throw new IllegalStateException("Global id is too long: " + toString()); + } + if (branchId.length > Xid.MAXBQUALSIZE) { + throw new IllegalStateException("Branch id is too long: " + toString()); + } } /** @@ -61,12 +71,14 @@ public class XidImpl implements Xid, Ser } branchId = branch; //this.hash = hash(hash, branchId); + check(); } public XidImpl(int formatId, byte[] globalId, byte[] branchId) { this.formatId = formatId; this.globalId = globalId; this.branchId = branchId; + check(); } private int hash(int hash, byte[] id) { @@ -106,15 +118,18 @@ public class XidImpl implements Xid, Ser } public String toString() { - StringBuffer s = new StringBuffer(); - s.append("[globalId="); + StringBuilder s = new StringBuilder(); + s.append("[Xid:globalId="); for (int i = 0; i < globalId.length; i++) { s.append(Integer.toHexString(globalId[i])); } + s.append(",length=").append(globalId.length); s.append(",branchId="); for (int i = 0; i < branchId.length; i++) { s.append(Integer.toHexString(branchId[i])); } + s.append(",length="); + s.append(branchId.length); s.append("]"); return s.toString(); }