org.rrd4j.core
Class RrdDbPoolOld

java.lang.Object
  extended by org.rrd4j.core.RrdDbPool
      extended by org.rrd4j.core.RrdDbPoolOld

public class RrdDbPoolOld
extends 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).


Field Summary
 
Fields inherited from class org.rrd4j.core.RrdDbPool
INITIAL_CAPACITY
 
Method Summary
 int getCapacity()
          Returns the maximum number of simultaneously open RRD files.
 int getOpenCount(RrdDb rrdDb)
          Returns the number of usage for a RRD.
 int getOpenCount(String path)
          Returns the number of usage for a RRD.
 int getOpenFileCount()
          Returns the number of open RRD files.
 String[] getOpenFiles()
          Returns an array of open file names.
 void release(RrdDb rrdDb)
          Releases RrdDb reference previously obtained from the pool.
 RrdDb requestRrdDb(RrdDef rrdDef)
          Requests a RrdDb reference for the given RRD file definition object.
 RrdDb requestRrdDb(String path)
          Requests a RrdDb reference for the given RRD file path.
 RrdDb requestRrdDb(String path, String sourcePath)
          Requests a RrdDb reference for the given path.
 void setCapacity(int capacity)
          Sets the maximum number of simultaneously open RRD files.
 
Methods inherited from class org.rrd4j.core.RrdDbPool
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

requestRrdDb

public RrdDb requestRrdDb(String path)
                   throws IOException
Description copied from class: RrdDbPool
Requests a RrdDb reference for the given RRD file path.

Specified by:
requestRrdDb in class RrdDbPool
Parameters:
path - Path to existing RRD file
Returns:
reference for the give RRD file
Throws:
IOException - Thrown in case of I/O error

requestRrdDb

public RrdDb requestRrdDb(RrdDef rrdDef)
                   throws IOException
Description copied from class: RrdDbPool
Requests a RrdDb reference for the given RRD file definition object.

Specified by:
requestRrdDb in class RrdDbPool
Parameters:
rrdDef - Definition of the RRD file to be created
Returns:
Reference to the newly created RRD file
Throws:
IOException - Thrown in case of I/O error

requestRrdDb

public RrdDb requestRrdDb(String path,
                          String sourcePath)
                   throws IOException
Description copied from class: RrdDbPool
Requests a RrdDb reference for the given path. The file will be created from external data (from XML dump, RRD file or RRDTool's binary RRD file).

Specified by:
requestRrdDb in class RrdDbPool
Parameters:
path - Path to RRD file which should be created
sourcePath - Path to external data which is to be converted to Rrd4j's native RRD file format
Returns:
Reference to the newly created RRD file
Throws:
IOException - Thrown in case of I/O error

release

public void release(RrdDb rrdDb)
             throws IOException
Description copied from class: RrdDbPool
Releases RrdDb reference previously obtained from the pool. When a reference is released, its usage count is decremented by one. If usage count drops to zero, the underlying RRD file will be closed.

Specified by:
release in class RrdDbPool
Parameters:
rrdDb - RrdDb reference to be returned to the pool
Throws:
IOException - Thrown in case of I/O error

getCapacity

public int getCapacity()
Description copied from class: RrdDbPool
Returns the maximum number of simultaneously open RRD files.

Specified by:
getCapacity in class RrdDbPool
Returns:
maximum number of simultaneously open RRD files

setCapacity

public void setCapacity(int capacity)
Description copied from class: RrdDbPool
Sets the maximum number of simultaneously open RRD files.

Specified by:
setCapacity in class RrdDbPool
Parameters:
capacity - Maximum number of simultaneously open RRD files.

getOpenFiles

public String[] getOpenFiles()
Description copied from class: RrdDbPool
Returns an array of open file names.

Specified by:
getOpenFiles in class RrdDbPool
Returns:
Array with canonical paths to open RRD files held in the pool.

getOpenFileCount

public int getOpenFileCount()
Description copied from class: RrdDbPool
Returns the number of open RRD files.

Specified by:
getOpenFileCount in class RrdDbPool
Returns:
Number of currently open RRD files held in the pool.

getOpenCount

public int getOpenCount(RrdDb rrdDb)
                 throws IOException
Description copied from class: RrdDbPool
Returns the number of usage for a RRD.

Specified by:
getOpenCount in class RrdDbPool
Parameters:
rrdDb - RrdDb reference for which informations is needed.
Returns:
the number of request for this rrd
Throws:
IOException

getOpenCount

public int getOpenCount(String path)
                 throws IOException
Description copied from class: RrdDbPool
Returns the number of usage for a RRD.

Specified by:
getOpenCount in class RrdDbPool
Parameters:
path - RRD file for which informations is needed.
Returns:
the number of request for this file
Throws:
IOException