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).| Modifier and Type | Class and Description |
|---|---|
static interface |
CachingDirectoryFactory.CloseListener |
| Modifier and Type | Field and Description |
|---|---|
protected Map<Directory,org.apache.solr.core.CachingDirectoryFactory.CacheValue> |
byDirectoryCache |
protected Map<String,org.apache.solr.core.CachingDirectoryFactory.CacheValue> |
byPathCache |
protected Map<Directory,List<CachingDirectoryFactory.CloseListener>> |
closeListeners |
| 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 abstract Directory |
create(String path)
Creates a new Directory for a given path.
|
void |
doneWithDirectory(Directory directory)
Indicates a Directory will no longer be used, and when it's 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,
String rawLockType)
Returns the Directory for a given path, using the specified rawLockType.
|
Directory |
get(String path,
String rawLockType,
boolean forceNew)
Returns the Directory for a given path, using the specified rawLockType.
|
void |
incRef(Directory directory)
Increment the number of references to the given Directory.
|
void |
init(NamedList args) |
void |
release(Directory directory)
Releases the Directory so that it may be closed when it is no longer
referenced.
|
protected Map<String,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byPathCache
protected Map<Directory,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byDirectoryCache
protected Map<Directory,List<CachingDirectoryFactory.CloseListener>> closeListeners
public void addCloseListener(Directory dir, CachingDirectoryFactory.CloseListener closeListener)
DirectoryFactoryaddCloseListener in class DirectoryFactorypublic void doneWithDirectory(Directory directory) throws IOException
DirectoryFactorydoneWithDirectory in class DirectoryFactoryIOExceptionpublic void close()
throws IOException
DirectoryFactoryclose in interface Closeableclose in class DirectoryFactoryIOExceptionprotected abstract Directory create(String path) throws IOException
DirectoryFactorycreate in class DirectoryFactoryIOExceptionpublic boolean exists(String path)
DirectoryFactoryexists in class DirectoryFactorypublic final Directory get(String path, String rawLockType) throws IOException
DirectoryFactoryget in class DirectoryFactoryIOExceptionpublic final Directory get(String path, String rawLockType, boolean forceNew) throws IOException
DirectoryFactoryDirectoryFactory.doneWithDirectory(Directory) in this case - the old Directory
will be closed when it's ref count hits 0.get in class DirectoryFactoryIOExceptionpublic void incRef(Directory directory)
DirectoryFactoryincRef in class DirectoryFactorypublic void init(NamedList args)
public void release(Directory directory) throws IOException
DirectoryFactoryrelease in class DirectoryFactoryIOExceptionCopyright © 2000-2012 Apache Software Foundation. All Rights Reserved.