Package org.rrd4j.core
Class RrdNioBackend
java.lang.Object
org.rrd4j.core.RrdBackend
org.rrd4j.core.ByteBufferBackend
org.rrd4j.core.RrdNioBackend
- All Implemented Interfaces:
RrdFileBackend
Backend which is used to store RRD data to ordinary disk files
using java.nio.* package. This is the default backend engine.
-
Field Summary
Fields inherited from class org.rrd4j.core.RrdBackend
BYTEORDER
-
Constructor Summary
ModifierConstructorDescriptionprotected
RrdNioBackend
(String path, boolean readOnly, RrdSyncThreadPool threadPool, int syncPeriod) Creates RrdFileBackend object for the given file path, backed by java.nio.* classes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying RRD file.Returns canonical path to the file on the disk.long
Returns the number of RRD bytes in the underlying storage.protected void
setLength
(long newLength) Sets the number of bytes in the underlying RRD storage.protected void
sync()
This method forces all data cached in memory but not yet stored in the file, to be stored in it.Methods inherited from class org.rrd4j.core.ByteBufferBackend
getCharBuffer, isDirty, read, readDouble, readDouble, readInt, readLong, readShort, rrdClose, setByteBuffer, write, writeDouble, writeDouble, writeDouble, writeInt, writeLong, writeShort, writeString
Methods inherited from class org.rrd4j.core.RrdBackend
done, getFactory, getPath, getUri, isCachingAllowed, isInstanceCreated, readAll, readString, writeString
-
Constructor Details
-
RrdNioBackend
protected RrdNioBackend(String path, boolean readOnly, RrdSyncThreadPool threadPool, int syncPeriod) throws IOException Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.- Parameters:
path
- Path to a filereadOnly
- True, if file should be open in a read-only mode. False otherwisethreadPool
- aRrdSyncThreadPool
object, it can be null.syncPeriod
- SeeRrdNioBackendFactory.setSyncPeriod(int)
for explanation- Throws:
IOException
- Thrown in case of I/O error
-
-
Method Details
-
setLength
Sets the number of bytes in the underlying RRD storage. This method is called only once, immediately after a new RRD storage gets created. Sets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.- Specified by:
setLength
in classRrdBackend
- Parameters:
newLength
- Length of the underlying RRD storage in bytes.- Throws:
IllegalArgumentException
- if the length is bigger that the possible mapping position (2GiB).IOException
- Thrown in case of I/O error.
-
close
Closes the underlying RRD file.- Overrides:
close
in classByteBufferBackend
- Throws:
IOException
- Thrown in case of I/O error.
-
sync
protected void sync()This method forces all data cached in memory but not yet stored in the file, to be stored in it. -
getLength
Description copied from class:RrdBackend
Returns the number of RRD bytes in the underlying storage.- Specified by:
getLength
in classRrdBackend
- Returns:
- Number of RRD bytes in the storage.
- Throws:
IOException
- Thrown in case of I/O error.
-
getCanonicalPath
Description copied from interface:RrdFileBackend
Returns canonical path to the file on the disk.- Specified by:
getCanonicalPath
in interfaceRrdFileBackend
- Returns:
- Canonical file path
- Throws:
IOException
- Thrown in case of I/O error
-