commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [1/2] commons-dbcp git commit: DBCP-476 Fixes race condition with WeakReference in clean up of AbandonedTrace
Date Mon, 07 May 2018 18:43:27 GMT
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 <gevesson@atlassian.com>
Authored: Thu Apr 27 11:19:21 2017 +1000
Committer: Pascal Schumacher <pascalschumacher@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();
                 }


Mime
View raw message