|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rrd4j.core.RrdDbPool
public abstract class RrdDbPool
This class should be used to synchronize access to RRD files in a multithreaded environment. This class should be also used to prevent opening of too many RRD files at the same time (thus avoiding operating system limits).
The abstract wrapper for different implementations of the pools.
Field Summary | |
---|---|
static int |
INITIAL_CAPACITY
Initial capacity of the pool i.e. maximum number of simultaneously open RRD files. |
Constructor Summary | |
---|---|
RrdDbPool()
|
Method Summary | |
---|---|
abstract int |
getCapacity()
Returns the maximum number of simultaneously open RRD files. |
static RrdDbPool |
getInstance()
Creates a single instance of the class on the first call, or returns already existing one. |
abstract int |
getOpenCount(RrdDb rrdDb)
Returns the number of usage for a RRD. |
abstract int |
getOpenCount(String path)
Returns the number of usage for a RRD. |
abstract int |
getOpenFileCount()
Returns the number of open RRD files. |
abstract String[] |
getOpenFiles()
Returns an array of open file names. |
abstract void |
release(RrdDb rrdDb)
Releases RrdDb reference previously obtained from the pool. |
abstract RrdDb |
requestRrdDb(RrdDef rrdDef)
Requests a RrdDb reference for the given RRD file definition object. |
abstract RrdDb |
requestRrdDb(String path)
Requests a RrdDb reference for the given RRD file path. |
abstract RrdDb |
requestRrdDb(String path,
String sourcePath)
Requests a RrdDb reference for the given path. |
abstract void |
setCapacity(int capacity)
Sets the maximum number of simultaneously open RRD files. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INITIAL_CAPACITY
Constructor Detail |
---|
public RrdDbPool()
Method Detail |
---|
public static RrdDbPool getInstance()
RuntimeException
- Thrown if the default RRD backend is not derived from the RrdFileBackendFactory
public abstract RrdDb requestRrdDb(String path) throws IOException
INITIAL_CAPACITY
, the file will be open and a new RrdDb reference will be returned.
If the file is not already open and the number of already open RRD files is equal to
INITIAL_CAPACITY
, the method blocks until some RRD file is closed.
path
- Path to existing RRD file
IOException
- Thrown in case of I/O errorpublic abstract RrdDb requestRrdDb(RrdDef rrdDef) throws IOException
INITIAL_CAPACITY
, a new RRD file will be created and a its RrdDb reference will be returned.
If the file is not already open and the number of already open RRD files is equal to
INITIAL_CAPACITY
, the method blocks until some RRD file is closed.
rrdDef
- Definition of the RRD file to be created
IOException
- Thrown in case of I/O errorpublic abstract RrdDb requestRrdDb(String path, String sourcePath) throws IOException
INITIAL_CAPACITY
, a new RRD file will be created and a its RrdDb reference will be returned.
If the file is not already open and the number of already open RRD files is equal to
INITIAL_CAPACITY
, the method blocks until some RRD file is closed.
path
- Path to RRD file which should be createdsourcePath
- Path to external data which is to be converted to Rrd4j's native RRD file format
IOException
- Thrown in case of I/O errorpublic abstract void release(RrdDb rrdDb) throws IOException
rrdDb
- RrdDb reference to be returned to the pool
IOException
- Thrown in case of I/O errorpublic abstract int getCapacity()
public abstract void setCapacity(int capacity)
capacity
- Maximum number of simultaneously open RRD files.public abstract String[] getOpenFiles()
public abstract int getOpenFileCount()
public abstract int getOpenCount(RrdDb rrdDb) throws IOException
rrdDb
- RrdDb reference for which informations is needed.
IOException
public abstract int getOpenCount(String path) throws IOException
path
- RRD file for which informations is needed.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |