public abstract class CachingDirectoryFactory extends DirectoryFactory
DirectoryFactory impl base class for caching Directory instances
per path. Most DirectoryFactory implementations will want to extend this
class and simply implement DirectoryFactory.create(String, LockFactory, DirContext).
This is an expert class and these API's are subject to change.| Modifier and Type | Class and Description |
|---|---|
protected class |
CachingDirectoryFactory.CacheValue |
static interface |
CachingDirectoryFactory.CloseListener |
DirectoryFactory.DirContext| Modifier and Type | Field and Description |
|---|---|
protected Map<Directory,CachingDirectoryFactory.CacheValue> |
byDirectoryCache |
protected Map<String,CachingDirectoryFactory.CacheValue> |
byPathCache |
protected Map<Directory,List<CachingDirectoryFactory.CloseListener>> |
closeListeners |
protected Set<CachingDirectoryFactory.CacheValue> |
removeEntries |
INDEX_W_TIMESTAMP_REGEX, IOCONTEXT_NO_CACHE, LOCK_TYPE_HDFS, LOCK_TYPE_NATIVE, LOCK_TYPE_NONE, LOCK_TYPE_SIMPLE, LOCK_TYPE_SINGLE| Constructor and Description |
|---|
CachingDirectoryFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(Directory dir,
CachingDirectoryFactory.CloseListener closeListener)
Adds a close listener for a Directory.
|
void |
close()
Close the this and all of the Directories it contains.
|
protected boolean |
deleteOldIndexDirectory(String oldDirPath) |
void |
doneWithDirectory(Directory directory)
Indicates a Directory will no longer be used, and when its ref count
hits 0, it can be closed.
|
boolean |
exists(String path)
Returns true if a Directory exists for a given path.
|
Directory |
get(String path,
DirectoryFactory.DirContext dirContext,
String rawLockType)
Returns the Directory for a given path, using the specified rawLockType.
|
Set<String> |
getLivePaths()
Test only method for inspecting the cache
|
void |
incRef(Directory directory)
Increment the number of references to the given Directory.
|
void |
init(NamedList args) |
String |
normalize(String path)
Normalize a given path.
|
void |
release(Directory directory)
Releases the Directory so that it may be closed when it is no longer
referenced.
|
void |
remove(Directory dir)
Removes the Directory's persistent storage.
|
void |
remove(Directory dir,
boolean deleteAfterCoreClose)
Removes the Directory's persistent storage.
|
void |
remove(String path)
This remove is special in that it may be called even after
the factory has been closed.
|
void |
remove(String path,
boolean deleteAfterCoreClose)
This remove is special in that it may be called even after
the factory has been closed.
|
protected void |
removeDirectory(CachingDirectoryFactory.CacheValue cacheValue) |
protected String |
stripTrailingSlash(String path) |
cleanupOldIndexDirectories, create, createLockFactory, empty, getDataHome, isAbsolute, isPersistent, isSharedStorage, move, offerMBeans, searchersReserveCommitPoints, sizeOf, sizeOfDirectoryprotected Map<String,CachingDirectoryFactory.CacheValue> byPathCache
protected Map<Directory,CachingDirectoryFactory.CacheValue> byDirectoryCache
protected Map<Directory,List<CachingDirectoryFactory.CloseListener>> closeListeners
protected Set<CachingDirectoryFactory.CacheValue> removeEntries
public void addCloseListener(Directory dir, CachingDirectoryFactory.CloseListener closeListener)
DirectoryFactoryaddCloseListener in class DirectoryFactorypublic void doneWithDirectory(Directory directory) throws IOException
DirectoryFactorydoneWithDirectory in class DirectoryFactoryIOException - If there is a low-level I/O error.public void close()
throws IOException
DirectoryFactoryclose in interface Closeableclose in interface AutoCloseableclose in class DirectoryFactoryIOException - If there is a low-level I/O error.public boolean exists(String path) throws IOException
DirectoryFactoryexists in class DirectoryFactoryIOException - If there is a low-level I/O error.public final Directory get(String path, DirectoryFactory.DirContext dirContext, String rawLockType) throws IOException
DirectoryFactoryget in class DirectoryFactoryIOException - If there is a low-level I/O error.public void incRef(Directory directory)
DirectoryFactoryincRef in class DirectoryFactorypublic void init(NamedList args)
public void release(Directory directory) throws IOException
DirectoryFactoryrelease in class DirectoryFactoryIOException - If there is a low-level I/O error.public void remove(String path) throws IOException
DirectoryFactoryremove in class DirectoryFactorypath - to removeIOException - If there is a low-level I/O error.public void remove(Directory dir) throws IOException
DirectoryFactoryremove in class DirectoryFactoryIOException - If there is a low-level I/O error.public void remove(String path, boolean deleteAfterCoreClose) throws IOException
DirectoryFactoryremove in class DirectoryFactorypath - to removedeleteAfterCoreClose - whether to wait until after the core is closed.IOException - If there is a low-level I/O error.public void remove(Directory dir, boolean deleteAfterCoreClose) throws IOException
DirectoryFactoryremove in class DirectoryFactoryIOException - If there is a low-level I/O error.protected void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue) throws IOException
IOExceptionpublic String normalize(String path) throws IOException
DirectoryFactorynormalize in class DirectoryFactorypath - to normalizeIOException - on io errorpublic Set<String> getLivePaths()
doneWithDirectory(org.apache.lucene.store.Directory)protected boolean deleteOldIndexDirectory(String oldDirPath) throws IOException
deleteOldIndexDirectory in class DirectoryFactoryIOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.