jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r411081 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
Date Fri, 02 Jun 2006 07:38:25 GMT
Author: mreutegg
Date: Fri Jun  2 00:38:24 2006
New Revision: 411081

URL: http://svn.apache.org/viewvc?rev=411081&view=rev
Log:
JCR-450: Memory leak in UUIDDocId

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java?rev=411081&r1=411080&r2=411081&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
Fri Jun  2 00:38:24 2006
@@ -22,6 +22,8 @@
 
 import java.io.IOException;
 import java.util.BitSet;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
 
 /**
  * Implements a document id which can be based on a Node uuid or a lucene
@@ -181,7 +183,7 @@
          * If <code>null</code> then the document number has not yet been
          * calculated.
          */
-        private IndexReader reader;
+        private Reference reader;
 
         /**
          * The previously calculated document number.
@@ -202,7 +204,7 @@
          */
         int getDocumentNumber(IndexReader reader) throws IOException {
             synchronized (this) {
-                if (reader == this.reader) {
+                if (this.reader != null && this.reader.get() == reader) {
                     return docNumber;
                 }
             }
@@ -218,7 +220,7 @@
             }
             synchronized (this) {
                 docNumber = doc;
-                this.reader = reader;
+                this.reader = new WeakReference(reader);
             }
             return doc;
         }



Mime
View raw message