jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject invalidating sharedIndexReader
Date Tue, 24 Jul 2007 13:48:15 GMT
Hello,

AFAICS from invalidatSharedReader() in AbstractReader the wrong method is called. Currently
it is:

sharedReader.close();

This means, that since SharedIndexReader does not overload the FilterIndexReader.close() method,
the close() method from org.apache.lucene.index.IndexReader is called, closing the reader.
But if I am correct there may be clients stored in the IdentityHashMap still working with
this reader? 

Therefore probably, the (unused) sharedReader.doClose() method in sharedReader is the one
that should be called from AbstractIndex.invalidateSharedReader(), right? 

If I am correct, ATM possible methods on a closed reader can be done [1]

Regards Ard

[1] http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/index/IndexReader.html#close()

code parts:

AbstractIndex:

protected synchronized void invalidateSharedReader() throws IOException {
        // invalidate shared reader
        if (sharedReader != null) {
            sharedReader.close();
            sharedReader = null;
        }
    }


SharedIndexReader:

protected synchronized void doClose() throws IOException {
        if (clients.isEmpty()) {
            super.doClose();
        } else {
            closeRequested = true;
        }
    }

-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers@hippo.nl / ard@apache.org / http://www.hippo.nl
-------------------------------------------------------------- 

Mime
View raw message