org.apache.solr.core
Class CachingDirectoryFactory

java.lang.Object
  extended by org.apache.solr.core.DirectoryFactory
      extended by org.apache.solr.core.CachingDirectoryFactory
All Implemented Interfaces:
Closeable, NamedListInitializedPlugin
Direct Known Subclasses:
MMapDirectoryFactory, NIOFSDirectoryFactory, SimpleFSDirectoryFactory, StandardDirectoryFactory

public abstract class CachingDirectoryFactory
extends DirectoryFactory

A 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).


Field Summary
protected  Map<Directory,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byDirectoryCache
           
protected  Map<String,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byPathCache
           
 
Constructor Summary
CachingDirectoryFactory()
           
 
Method Summary
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

byPathCache

protected Map<String,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byPathCache

byDirectoryCache

protected Map<Directory,org.apache.solr.core.CachingDirectoryFactory.CacheValue> byDirectoryCache
Constructor Detail

CachingDirectoryFactory

public CachingDirectoryFactory()
Method Detail

close

public void close()
           throws IOException
Description copied from class: DirectoryFactory
Close the this and all of the Directories it contains.

Specified by:
close in interface Closeable
Specified by:
close in class DirectoryFactory
Throws:
IOException

create

protected abstract Directory create(String path)
                             throws IOException
Description copied from class: DirectoryFactory
Creates a new Directory for a given path.

Specified by:
create in class DirectoryFactory
Throws:
IOException

exists

public boolean exists(String path)
Description copied from class: DirectoryFactory
Returns true if a Directory exists for a given path.

Specified by:
exists in class DirectoryFactory

get

public final Directory get(String path,
                           String rawLockType)
                    throws IOException
Description copied from class: DirectoryFactory
Returns the Directory for a given path, using the specified rawLockType. Will return the same Directory instance for the same path.

Specified by:
get in class DirectoryFactory
Throws:
IOException

get

public final Directory get(String path,
                           String rawLockType,
                           boolean forceNew)
                    throws IOException
Description copied from class: DirectoryFactory
Returns the Directory for a given path, using the specified rawLockType. Will return the same Directory instance for the same path unless forceNew, in which case a new Directory is returned.

Specified by:
get in class DirectoryFactory
Throws:
IOException

incRef

public void incRef(Directory directory)
Description copied from class: DirectoryFactory
Increment the number of references to the given Directory. You must call release for every call to this method.

Specified by:
incRef in class DirectoryFactory

init

public void init(NamedList args)

release

public void release(Directory directory)
             throws IOException
Description copied from class: DirectoryFactory
Releases the Directory so that it may be closed when it is no longer referenced.

Specified by:
release in class DirectoryFactory
Throws:
IOException


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.