|
|||||||||
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.RrdSafeFileBackend
public class RrdSafeFileBackend
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 *slow* since it does not use fast java.nio.* package (it's still based on the RandomAccessFile class).
Field Summary | |
---|---|
static int |
LOCK_RETRY_COUNT
Number of locking retries. |
static int |
LOCK_RETRY_DELAY
Number of milliseconds between locking retries |
Fields inherited from class org.jrobin.core.RrdFileBackend |
---|
file, fileLock, lockMode, readOnly |
Constructor Summary | |
---|---|
RrdSafeFileBackend(java.lang.String path,
boolean readOnly,
int lockMode)
Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object. |
Method Summary | |
---|---|
protected void |
afterFetch()
Unlocks the underlying RRD file just after the RRD fetch operation. |
protected void |
afterUpdate()
Unlocks the underlying RRD file just after the RRD update operation. |
protected void |
beforeClose()
Releases the file lock before closing the RRD file (if not already released). |
protected void |
beforeFetch()
Locks the underlying RRD file just before the next RRD fetch operation. |
protected void |
beforeUpdate()
Locks the underlying RRD file just before the next RRD update operation. |
protected boolean |
isCachingAllowed()
Defines the caching policy for this backend. |
Methods inherited from class org.jrobin.core.RrdFileBackend |
---|
close, getCanonicalPath, getCanonicalPath, getLength, read, setLength, write |
Methods inherited from class org.jrobin.core.RrdBackend |
---|
afterCreate, getPath, readAll, sync |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOCK_RETRY_COUNT
public static final int LOCK_RETRY_DELAY
Constructor Detail |
---|
public RrdSafeFileBackend(java.lang.String path, boolean readOnly, int lockMode) throws java.io.IOException
path
- Path to a filereadOnly
- True, if file should be open in a read-only mode. False otherwiselockMode
- Ignored, since this backend implements its own locking mechanism
java.io.IOException
- Thrown in case of I/O errorMethod Detail |
---|
protected boolean isCachingAllowed()
isCachingAllowed
in class RrdBackend
false
protected void beforeUpdate() throws java.io.IOException
beforeUpdate
in class RrdBackend
java.io.IOException
- Thrown if the file lock could not be obtained.protected void afterUpdate() throws java.io.IOException
afterUpdate
in class RrdBackend
java.io.IOException
- Thrown if the lock could not be released.protected void beforeFetch() throws java.io.IOException
beforeFetch
in class RrdBackend
java.io.IOException
- Thrown if the file lock could not be obtained.protected void afterFetch() throws java.io.IOException
afterFetch
in class RrdBackend
java.io.IOException
- Thrown if the lock could not be released.protected void beforeClose() throws java.io.IOException
beforeClose
in class RrdBackend
java.io.IOException
- Thrown if the lock could not be released.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |