You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pa...@apache.org on 2018/05/07 18:43:27 UTC

[1/2] commons-dbcp git commit: DBCP-476 Fixes race condition with WeakReference in clean up of AbandonedTrace

Repository: commons-dbcp
Updated Branches:
  refs/heads/master ff38c184f -> c046e8639


DBCP-476 Fixes race condition with WeakReference in clean up of AbandonedTrace


Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/1a5b367e
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/1a5b367e
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/1a5b367e

Branch: refs/heads/master
Commit: 1a5b367ebabe8dfc3b37481472dca48f115cd261
Parents: ff38c18
Author: Gary Evesson <ge...@atlassian.com>
Authored: Thu Apr 27 11:19:21 2017 +1000
Committer: Pascal Schumacher <pa...@gmx.net>
Committed: Mon May 7 20:40:30 2018 +0200

----------------------------------------------------------------------
 .../java/org/apache/commons/dbcp2/AbandonedTrace.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/1a5b367e/src/main/java/org/apache/commons/dbcp2/AbandonedTrace.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbcp2/AbandonedTrace.java b/src/main/java/org/apache/commons/dbcp2/AbandonedTrace.java
index e62c100..983d40a 100644
--- a/src/main/java/org/apache/commons/dbcp2/AbandonedTrace.java
+++ b/src/main/java/org/apache/commons/dbcp2/AbandonedTrace.java
@@ -133,12 +133,12 @@ public class AbandonedTrace implements TrackedUse {
         synchronized (this.traceList) {
             final Iterator<WeakReference<AbandonedTrace>> iter = traceList.iterator();
             while (iter.hasNext()) {
-                final WeakReference<AbandonedTrace> ref = iter.next();
-                if (ref.get() == null) {
+                final AbandonedTrace trace = iter.next().get();
+                if (trace == null) {
                     // Clean-up since we are here anyway
                     iter.remove();
                 } else {
-                    result.add(ref.get());
+                    result.add(trace);
                 }
             }
         }
@@ -154,11 +154,11 @@ public class AbandonedTrace implements TrackedUse {
         synchronized(this.traceList) {
             final Iterator<WeakReference<AbandonedTrace>> iter = traceList.iterator();
             while (iter.hasNext()) {
-                final WeakReference<AbandonedTrace> ref = iter.next();
-                if (trace.equals(ref.get())) {
+                final AbandonedTrace traceInList = iter.next().get();
+                if (trace.equals(traceInList)) {
                     iter.remove();
                     break;
-                } else if (ref.get() == null) {
+                } else if (traceInList == null) {
                     // Clean-up since we are here anyway
                     iter.remove();
                 }


[2/2] commons-dbcp git commit: DBCP-476: AbandonedTrace.getTrace() contains race condition

Posted by pa...@apache.org.
DBCP-476: AbandonedTrace.getTrace() contains race condition

add changes.xml entry


Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/c046e863
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/c046e863
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/c046e863

Branch: refs/heads/master
Commit: c046e86395b4a1ededbd7595e9500528195c58ed
Parents: 1a5b367
Author: Pascal Schumacher <pa...@gmx.net>
Authored: Mon May 7 20:43:16 2018 +0200
Committer: Pascal Schumacher <pa...@gmx.net>
Committed: Mon May 7 20:43:16 2018 +0200

----------------------------------------------------------------------
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/c046e863/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 41a035e..fa85cb5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -61,6 +61,9 @@ The <action> type attribute can be add,update,fix,remove.
 
   <body>
     <release version="2.3.0" date="2018-MM-DD" description="This is a minor release, including bug fixes and enhancements.">
+      <action dev="pschumacher" type="fix" issue="DBCP-476" due-to="Gary Evesson, Richard Cordova">
+        AbandonedTrace.getTrace() contains race condition
+      </action>
       <action dev="ggregory" type="fix" issue="DBCP-482" due-to="Dennis Lloyd, Gary Gregory">
         Avoid javax.management.InstanceNotFoundException on shutdown when a bean is not registered.
       </action>