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
public class RrdNioBackend extends ByteBufferBackend implements 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
Constructors Modifier Constructor Description protectedRrdNioBackend(String path, boolean readOnly, RrdSyncThreadPool threadPool, int syncPeriod)Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying RRD file.StringgetCanonicalPath()Returns canonical path to the file on the disk.longgetLength()Returns the number of RRD bytes in the underlying storage.protected voidsetLength(long newLength)Sets the number of bytes in the underlying RRD storage.protected voidsync()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 Detail
-
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 otherwisesyncPeriod- SeeRrdNioBackendFactory.setSyncPeriod(int)for explanationthreadPool- aRrdSyncThreadPoolobject, it can be null.- Throws:
IOException- Thrown in case of I/O error
-
-
Method Detail
-
setLength
protected void setLength(long newLength) throws IOExceptionSets 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:
setLengthin 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
public void close() throws IOExceptionCloses the underlying RRD file.- Overrides:
closein 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
public long getLength() throws IOExceptionDescription copied from class:RrdBackendReturns the number of RRD bytes in the underlying storage.- Specified by:
getLengthin classRrdBackend- Returns:
- Number of RRD bytes in the storage.
- Throws:
IOException- Thrown in case of I/O error.
-
getCanonicalPath
public String getCanonicalPath() throws IOException
Description copied from interface:RrdFileBackendReturns canonical path to the file on the disk.- Specified by:
getCanonicalPathin interfaceRrdFileBackend- Returns:
- Canonical file path
- Throws:
IOException- Thrown in case of I/O error
-
-