commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r672097 - in /commons/proper/dbcp/trunk: src/java/org/apache/commons/dbcp/AbandonedTrace.java xdocs/changes.xml
Date Fri, 27 Jun 2008 02:48:06 GMT
Author: psteitz
Date: Thu Jun 26 19:48:06 2008
New Revision: 672097

URL: http://svn.apache.org/viewvc?rev=672097&view=rev
Log:
Narrowed synchronization in AbandonedTrace to resolve an Evictor deadlock.
JIRA: DBCP-270
Reported and patched by Filip Hanik.

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java
    commons/proper/dbcp/trunk/xdocs/changes.xml

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java?rev=672097&r1=672096&r2=672097&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/AbandonedTrace.java Thu Jun
26 19:48:06 2008
@@ -172,7 +172,7 @@
      * @param trace AbandonedTrace object to add
      */
     protected void addTrace(AbandonedTrace trace) {
-        synchronized (this) {
+        synchronized (this.trace) {
             this.trace.add(trace);
         }
         setLastUsed();
@@ -182,8 +182,8 @@
      * Clear the list of objects being traced by this
      * object.
      */
-    protected synchronized void clearTrace() {
-        if (this.trace != null) {
+    protected void clearTrace() {
+        synchronized(this.trace) {
             this.trace.clear();
         }
     }
@@ -194,7 +194,9 @@
      * @return List of objects
      */
     protected List getTrace() {
-        return trace;
+        synchronized (this.trace) {
+            return new ArrayList(trace);
+    }
     }
 
     /**
@@ -206,7 +208,7 @@
             System.out.println(format.format(new Date(createdTime)));
             createdBy.printStackTrace(System.out);
         }
-        synchronized(this) {
+        synchronized(this.trace) {
             Iterator it = this.trace.iterator();
             while (it.hasNext()) {
                 AbandonedTrace at = (AbandonedTrace)it.next();
@@ -220,8 +222,8 @@
      *
      * @param trace AbandonedTrace object to remvoe
      */
-    protected synchronized void removeTrace(AbandonedTrace trace) {
-        if (this.trace != null) {
+    protected void removeTrace(AbandonedTrace trace) {
+        synchronized(this.trace) {
             this.trace.remove(trace);
         }
     }

Modified: commons/proper/dbcp/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/xdocs/changes.xml?rev=672097&r1=672096&r2=672097&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/xdocs/changes.xml (original)
+++ commons/proper/dbcp/trunk/xdocs/changes.xml Thu Jun 26 19:48:06 2008
@@ -42,6 +42,9 @@
      new features as well as bug fixes and instrumentation.  Some bug fixes
      will change semantics (e.g. connection close will become idempotent).
      The minimum JDK level will be increased to 1.4">
+      <action dev="psteitz" type="fix" issue="DBCP-270" due-to="Filip Hanik">
+        Narrowed synchronization in AbandonedTrace to resolve an Evictor deadlock.
+      </action>
       <action dev="bayard" type="fix" issue="DBCP-218">
         Corrected Javadoc to state that getLoginTimeout and setLoginTimeout are
         NOT supported by BasicDataSource.



Mime
View raw message