Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 461 invoked from network); 6 Aug 2006 03:27:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Aug 2006 03:27:14 -0000 Received: (qmail 2666 invoked by uid 500); 6 Aug 2006 03:27:13 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 2638 invoked by uid 500); 6 Aug 2006 03:27: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 2622 invoked by uid 99); 6 Aug 2006 03:27:13 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Aug 2006 20:27:13 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Aug 2006 20:27:12 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 56E951A981A; Sat, 5 Aug 2006 20:26:46 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r429099 - /geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java Date: Sun, 06 Aug 2006 03:26:45 -0000 To: scm@geronimo.apache.org From: dain@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060806032646.56E951A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: dain Date: Sat Aug 5 20:26:45 2006 New Revision: 429099 URL: http://svn.apache.org/viewvc?rev=429099&view=rev Log: Synchronize ConnectorTransactionContext.managedConnections - This is not necessary since this method is only called by the thread associated with the transaction and only on thread can be associated with the transaction at a time. But, it is just safe and since there will be no contention, this won't hurt performance. Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java Modified: geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java URL: http://svn.apache.org/viewvc/geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java?rev=429099&r1=429098&r2=429099&view=diff ============================================================================== --- geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java (original) +++ geronimo/branches/dain/notcm/modules/connector/src/java/org/apache/geronimo/connector/ConnectorTransactionContext.java Sat Aug 5 20:26:45 2006 @@ -65,14 +65,14 @@ private Map managedConnections; - public Object getManagedConnectionInfo(ConnectionReleaser key) { + public synchronized Object getManagedConnectionInfo(ConnectionReleaser key) { if (managedConnections == null) { return null; } return managedConnections.get(key); } - public void setManagedConnectionInfo(ConnectionReleaser key, Object info) { + public synchronized void setManagedConnectionInfo(ConnectionReleaser key, Object info) { if (managedConnections == null) { managedConnections = new HashMap(); } @@ -93,15 +93,17 @@ public void afterCompletion(int status) { try { - if (ctx.managedConnections != null) { - for (Iterator entries = ctx.managedConnections.entrySet().iterator(); entries.hasNext();) { - Map.Entry entry = (Map.Entry) entries.next(); - ConnectionReleaser key = (ConnectionReleaser) entry.getKey(); - key.afterCompletion(entry.getValue()); + synchronized (ctx) { + if (ctx.managedConnections != null) { + for (Iterator entries = ctx.managedConnections.entrySet().iterator(); entries.hasNext();) { + Map.Entry entry = (Map.Entry) entries.next(); + ConnectionReleaser key = (ConnectionReleaser) entry.getKey(); + key.afterCompletion(entry.getValue()); + } + //If BeanTransactionContext never reuses the same instance for sequential BMT, this + //clearing is unnecessary. + ctx.managedConnections.clear(); } - //If BeanTransactionContext never reuses the same instance for sequential BMT, this - //clearing is unnecessary. - ctx.managedConnections.clear(); } } finally { remove(transaction);