Class RrdNioBackend
java.lang.Object
org.jrobin.core.RrdBackend
org.jrobin.core.RrdFileBackend
net.bull.javamelody.internal.model.RrdNioBackend
public class RrdNioBackend
extends org.jrobin.core.RrdFileBackend
JRobin backend which is used to store RRD data to ordinary disk files
by using fast java.nio.* package. This is the default backend engine since JRobin 1.4.0.
-
Field Summary
Fields inherited from class org.jrobin.core.RrdFileBackend
file, readOnly -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRrdNioBackend(String path, boolean readOnly, int syncPeriod) Creates RrdFileBackend object for the given file path, backed by java.nio.* classes. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying RRD file.static Timerprotected voidread(long offset, byte[] b) Reads a number of bytes from the RRD file on the diskstatic voidsetFileSyncTimer(Timer timer) Sets the timer.protected voidsetLength(long newLength) Sets length of the underlying RRD file.protected voidsync()This method forces all data cached in memory but not yet stored in the file, to be stored in it.protected voidwrite(long offset, byte[] b) Writes bytes to the underlying RRD file on the diskMethods inherited from class org.jrobin.core.RrdFileBackend
getCanonicalPath, getCanonicalPath, getLengthMethods inherited from class org.jrobin.core.RrdBackend
getPath, isCachingAllowed, readAll
-
Constructor Details
-
RrdNioBackend
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 explanation- Throws:
IOException- Thrown in case of I/O error
-
-
Method Details
-
getFileSyncTimer
- Returns:
- The timer to synchronize files.
-
setFileSyncTimer
Sets the timer.- Parameters:
timer- timer to synchronize files.
-
setLength
Sets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.- Overrides:
setLengthin classorg.jrobin.core.RrdFileBackend- Parameters:
newLength- Length of the RRD file- Throws:
IOException- Thrown in case of I/O error.
-
write
Writes bytes to the underlying RRD file on the disk- Overrides:
writein classorg.jrobin.core.RrdFileBackend- Parameters:
offset- Starting file offsetb- Bytes to be written.- Throws:
IOException
-
read
Reads a number of bytes from the RRD file on the disk- Overrides:
readin classorg.jrobin.core.RrdFileBackend- Parameters:
offset- Starting file offsetb- Buffer which receives bytes read from the file.- Throws:
IOException
-
close
Closes the underlying RRD file.- Overrides:
closein classorg.jrobin.core.RrdFileBackend- 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.
-