|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jrobin.core.RrdBackend
org.jrobin.core.RrdFileBackend
org.jrobin.core.RrdNioBackend
public class RrdNioBackend
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 | |
---|---|
static boolean |
SHOULD_GC
Defines System.gc() usage policy for this backend. |
Fields inherited from class org.jrobin.core.RrdFileBackend |
---|
channel, file, fileLock |
Constructor Summary | |
---|---|
protected |
RrdNioBackend(java.lang.String path,
boolean readOnly,
int lockMode,
int syncMode,
int syncPeriod)
|
Method Summary | |
---|---|
protected void |
afterFetch()
Method called by the framework immediatelly after RRD fetch operation finishes. |
protected void |
afterUpdate()
Method called by the framework immediatelly after RRD update operation finishes. |
protected void |
beforeFetch()
Method called by the framework immediatelly before RRD fetch operation starts. |
protected void |
beforeUpdate()
Method called by the framework immediatelly before RRD update operation starts. |
void |
close()
Closes the underlying RRD file. |
protected void |
read(long offset,
byte[] b)
Reads a number of bytes from the RRD file on the disk |
protected void |
setLength(long newLength)
Sets length of the underlying RRD file. |
void |
sync()
This method forces all data cached in memory but not yet stored in the file, to be stored in it. |
protected void |
write(long offset,
byte[] b)
Writes bytes to the underlying RRD file on the disk |
Methods inherited from class org.jrobin.core.RrdFileBackend |
---|
finalize, getCanonicalPath, getCanonicalPath, getLength |
Methods inherited from class org.jrobin.core.RrdBackend |
---|
afterCreate, getPath, readAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean SHOULD_GC
System.gc()
usage policy for this backend.
NIO backend uses potentially large in-memory buffer to cache file data.
The buffer remains 'active' (by prohibiting file re-creation with the smaller file size)
as long as it is not garbage-collected. By forcing System.gc()
call where
appropriate, this backend will free in-memory buffers sooner and file re-creation won't fail.
The constant is set to true
initially and currently there is no
API to change it during runtime.
Garbage collection will be forced only in some special circumstances.
It should not affect the speed of your application significantly.
Constructor Detail |
---|
protected RrdNioBackend(java.lang.String path, boolean readOnly, int lockMode, int syncMode, int syncPeriod) throws java.io.IOException
java.io.IOException
Method Detail |
---|
protected void setLength(long newLength) throws java.io.IOException
setLength
in class RrdFileBackend
newLength
- Length of the RRD file
java.io.IOException
- Thrown in case of I/O error.protected void write(long offset, byte[] b)
write
in class RrdFileBackend
offset
- Starting file offsetb
- Bytes to be written.protected void read(long offset, byte[] b)
read
in class RrdFileBackend
offset
- Starting file offsetb
- Buffer which receives bytes read from the file.public void close() throws java.io.IOException
close
in class RrdFileBackend
java.io.IOException
- Thrown in case of I/O errorpublic void sync()
close()
method is called. In other words, you don't have to call sync() before you call close().
sync
in class RrdBackend
protected void beforeUpdate()
RrdNioBackendFactory.SYNC_BEFOREUPDATE
. Otherwise it does nothing.
beforeUpdate
in class RrdBackend
protected void afterUpdate()
RrdNioBackendFactory.SYNC_AFTERUPDATE
. Otherwise it does nothing.
afterUpdate
in class RrdBackend
protected void beforeFetch()
RrdNioBackendFactory.SYNC_BEFOREFETCH
. Otherwise it does nothing.
beforeFetch
in class RrdBackend
protected void afterFetch()
RrdNioBackendFactory.SYNC_AFTERFETCH
. Otherwise it does nothing.
afterFetch
in class RrdBackend
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |