public class MetricsDirectoryFactory extends DirectoryFactory implements SolrCoreAware
DirectoryFactory
that decorates provided factory by
adding metrics for directory IO operations.Modifier and Type | Class and Description |
---|---|
static class |
MetricsDirectoryFactory.MetricsDirectory |
static class |
MetricsDirectoryFactory.MetricsInput |
static class |
MetricsDirectoryFactory.MetricsOutput |
DirectoryFactory.DirContext
coreContainer, 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 |
---|
MetricsDirectoryFactory(SolrMetricManager metricManager,
String registry,
DirectoryFactory in) |
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(Directory dir,
CachingDirectoryFactory.CloseListener closeListener)
Adds a close listener for a Directory.
|
void |
cleanupOldIndexDirectories(String dataDirPath,
String currentIndexDirPath) |
void |
close()
Close the this and all of the Directories it contains.
|
protected Directory |
create(String path,
LockFactory lockFactory,
DirectoryFactory.DirContext dirContext)
Creates a new Directory for a given path.
|
protected LockFactory |
createLockFactory(String rawLockType)
Creates a new LockFactory for a given path.
|
protected boolean |
deleteOldIndexDirectory(String oldDirPath) |
void |
doneWithDirectory(Directory dir)
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.
|
String |
getDataHome(CoreDescriptor cd) |
DirectoryFactory |
getDelegate() |
void |
incRef(Directory dir)
Increment the number of references to the given Directory.
|
void |
inform(SolrCore core) |
void |
init(NamedList args)
Currently the following arguments are supported:
directoryDetails - (optional bool) when true then additional detailed metrics
will be collected. |
void |
initCoreContainer(CoreContainer cc) |
boolean |
isAbsolute(String path) |
boolean |
isPersistent() |
boolean |
isSharedStorage() |
void |
move(Directory fromDir,
Directory toDir,
String fileName,
IOContext ioContext)
Override for more efficient moves.
|
String |
normalize(String path)
Normalize a given path.
|
Collection<SolrInfoMBean> |
offerMBeans()
Optionally allow the DirectoryFactory to request registration of some MBeans.
|
void |
release(Directory dir)
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 afterCoreClose)
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 afterCoreClose)
This remove is special in that it may be called even after
the factory has been closed.
|
void |
renameWithOverwrite(Directory dir,
String fileName,
String toName) |
boolean |
searchersReserveCommitPoints()
If your implementation can count on delete-on-last-close semantics
or throws an exception when trying to remove a file in use, return
false (eg NFS).
|
long |
size(Directory dir) |
long |
size(String path) |
empty, getBaseDir, sizeOf, sizeOfDirectory
public MetricsDirectoryFactory(SolrMetricManager metricManager, String registry, DirectoryFactory in)
public DirectoryFactory getDelegate()
public void init(NamedList args)
directoryDetails
- (optional bool) when true then additional detailed metrics
will be collected. These include eg. IO size histograms and per-file counters and histogramsinit
in interface NamedListInitializedPlugin
args
- init argspublic void doneWithDirectory(Directory dir) throws IOException
DirectoryFactory
doneWithDirectory
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public void addCloseListener(Directory dir, CachingDirectoryFactory.CloseListener closeListener)
DirectoryFactory
addCloseListener
in class DirectoryFactory
public void close() throws IOException
DirectoryFactory
close
in interface Closeable
close
in interface AutoCloseable
close
in class DirectoryFactory
IOException
- If there is a low-level I/O error.protected Directory create(String path, LockFactory lockFactory, DirectoryFactory.DirContext dirContext) throws IOException
DirectoryFactory
create
in class DirectoryFactory
IOException
- If there is a low-level I/O error.protected LockFactory createLockFactory(String rawLockType) throws IOException
DirectoryFactory
createLockFactory
in class DirectoryFactory
rawLockType
- A string value as passed in config. Every factory should at least support 'none' to disable locking.IOException
- If there is a low-level I/O error.public boolean exists(String path) throws IOException
DirectoryFactory
exists
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public void remove(Directory dir) throws IOException
DirectoryFactory
remove
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public void remove(Directory dir, boolean afterCoreClose) throws IOException
DirectoryFactory
remove
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public boolean isSharedStorage()
isSharedStorage
in class DirectoryFactory
public boolean isAbsolute(String path)
isAbsolute
in class DirectoryFactory
path
- the path to checkpublic boolean searchersReserveCommitPoints()
DirectoryFactory
searchersReserveCommitPoints
in class DirectoryFactory
public String getDataHome(CoreDescriptor cd) throws IOException
getDataHome
in class DirectoryFactory
IOException
public long size(Directory dir) throws IOException
size
in class DirectoryFactory
dir
- to calculate size ofIOException
- on low level IO errorpublic long size(String path) throws IOException
size
in class DirectoryFactory
path
- to calculate size ofIOException
- on low level IO errorpublic Collection<SolrInfoMBean> offerMBeans()
DirectoryFactory
offerMBeans
in class DirectoryFactory
public void cleanupOldIndexDirectories(String dataDirPath, String currentIndexDirPath)
cleanupOldIndexDirectories
in class DirectoryFactory
public void remove(String path, boolean afterCoreClose) throws IOException
DirectoryFactory
remove
in class DirectoryFactory
path
- to removeafterCoreClose
- whether to wait until after the core is closed.IOException
- If there is a low-level I/O error.public void remove(String path) throws IOException
DirectoryFactory
remove
in class DirectoryFactory
path
- to removeIOException
- If there is a low-level I/O error.public void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext) throws IOException
DirectoryFactory
move
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public void renameWithOverwrite(Directory dir, String fileName, String toName) throws IOException
renameWithOverwrite
in class DirectoryFactory
IOException
public Directory get(String path, DirectoryFactory.DirContext dirContext, String rawLockType) throws IOException
DirectoryFactory
get
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public String normalize(String path) throws IOException
DirectoryFactory
normalize
in class DirectoryFactory
path
- to normalizeIOException
- on io errorprotected boolean deleteOldIndexDirectory(String oldDirPath) throws IOException
deleteOldIndexDirectory
in class DirectoryFactory
IOException
public void initCoreContainer(CoreContainer cc)
initCoreContainer
in class DirectoryFactory
public void incRef(Directory dir)
DirectoryFactory
incRef
in class DirectoryFactory
public boolean isPersistent()
isPersistent
in class DirectoryFactory
public void inform(SolrCore core)
inform
in interface SolrCoreAware
public void release(Directory dir) throws IOException
DirectoryFactory
release
in class DirectoryFactory
IOException
- If there is a low-level I/O error.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.