activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r652562 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
Date Thu, 01 May 2008 16:03:00 GMT
Author: chirino
Date: Thu May  1 09:02:59 2008
New Revision: 652562

URL: http://svn.apache.org/viewvc?rev=652562&view=rev
Log:
Fix threading issue which was causing a memory leak. Basically the writes were getting added
to the in flight map
after they were enqueued to get written and in that time span they could be been processed
and the remove() would occur before the add witch caused the leak.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java?rev=652562&r1=652561&r2=652562&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
Thu May  1 09:02:59 2008
@@ -167,6 +167,9 @@
         synchronized (this) {
             // Find the position where this item will land at.
             DataFile dataFile = dataManager.allocateLocation(location);
+            if( !sync ) {
+                inflightWrites.put(new WriteKey(location), write);
+            }
             batch = enqueue(dataFile, write);
         }
         location.setLatch(batch.latch);
@@ -176,8 +179,6 @@
             } catch (InterruptedException e) {
                 throw new InterruptedIOException();
             }
-        } else {
-            inflightWrites.put(new WriteKey(location), write);
         }
 
         return location;
@@ -201,10 +202,10 @@
         synchronized (this) {
             // Find the position where this item will land at.
             DataFile dataFile = dataManager.allocateLocation(location);
+            inflightWrites.put(new WriteKey(location), write);
             batch = enqueue(dataFile, write);
         }
         location.setLatch(batch.latch);
-        inflightWrites.put(new WriteKey(location), write);
 
         return location;
 	}



Mime
View raw message