Package org.jrobin.core
Class RrdSafeFileBackend
- java.lang.Object
-
- org.jrobin.core.RrdBackend
-
- org.jrobin.core.RrdFileBackend
-
- org.jrobin.core.RrdSafeFileBackend
-
public class RrdSafeFileBackend extends RrdFileBackend
JRobin backend which is used to store RRD data to ordinary files on the disk. This backend is SAFE: it locks the underlying RRD file during update/fetch operations, and caches only static parts of a RRD file in memory. Therefore, this backend is safe to be used when RRD files should be shared between several JVMs at the same time. However, this backend is a little bit slow since it does not use fast java.nio.* package (it's still based on the RandomAccessFile class).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
RrdSafeFileBackend.Counters
-
Field Summary
-
Fields inherited from class org.jrobin.core.RrdFileBackend
file
-
-
Constructor Summary
Constructors Constructor Description RrdSafeFileBackend(String path, long lockWaitTime, long lockRetryPeriod)
Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying RRD file.static String
getLockInfo()
protected boolean
isCachingAllowed()
Defines the caching policy for this backend.-
Methods inherited from class org.jrobin.core.RrdFileBackend
getCanonicalPath, getCanonicalPath, getLength, read, setLength, write
-
Methods inherited from class org.jrobin.core.RrdBackend
getPath, isInstanceCreated, isReadOnly, readAll, readDouble, readDouble, readInt, readLong, readString, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeString
-
-
-
-
Constructor Detail
-
RrdSafeFileBackend
public RrdSafeFileBackend(String path, long lockWaitTime, long lockRetryPeriod) throws IOException
Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object.- Parameters:
path
- Path to a filelockWaitTime
- lock waiting time in millisecondslockRetryPeriod
- lock retry period in milliseconds- Throws:
IOException
- Thrown in case of I/O error
-
-
Method Detail
-
close
public void close() throws IOException
Description copied from class:RrdFileBackend
Closes the underlying RRD file.- Overrides:
close
in classRrdFileBackend
- Throws:
IOException
- Thrown in case of I/O error
-
isCachingAllowed
protected boolean isCachingAllowed()
Defines the caching policy for this backend.- Overrides:
isCachingAllowed
in classRrdBackend
- Returns:
false
-
getLockInfo
public static String getLockInfo()
-
-