LUCENE-5812: NRTCachingDirectory now implements Accountable

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1609459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2014-07-10 13:55:37 +00:00
parent c41722b75a
commit 8e7ad8727c
1 changed files with 7 additions and 7 deletions

View File

@ -24,6 +24,7 @@ import java.util.Set;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.store.RAMDirectory; // javadocs
import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.IOUtils;
// TODO
@ -63,7 +64,7 @@ import org.apache.lucene.util.IOUtils;
* @lucene.experimental
*/
public class NRTCachingDirectory extends FilterDirectory {
public class NRTCachingDirectory extends FilterDirectory implements Accountable {
private final RAMDirectory cache = new RAMDirectory();
@ -117,12 +118,6 @@ public class NRTCachingDirectory extends FilterDirectory {
return files.toArray(new String[files.size()]);
}
/** Returns how many bytes are being used by the
* RAMDirectory cache */
public long cacheRamBytesUsed() {
return cache.ramBytesUsed();
}
@Override
public synchronized void deleteFile(String name) throws IOException {
if (VERBOSE) {
@ -261,4 +256,9 @@ public class NRTCachingDirectory extends FilterDirectory {
}
}
}
@Override
public long ramBytesUsed() {
return cache.ramBytesUsed();
}
}