@RrdBackendAnnotation(name="SAFE", shouldValidateHeader=true, cachingAllowed=false) public class RrdSafeFileBackendFactory extends RrdRandomAccessFileBackendFactory
RrdSafeFileBackend
objects.
Because of locking, each RrdDb can be open only once even from within the JVM. So usage
of the RrdDbPool
is mandatory with this backend.
Modifier and Type | Field and Description |
---|---|
static long |
LOCK_RETRY_PERIOD
Default time between two consecutive file locking attempts.
|
static long |
LOCK_WAIT_TIME
Default time (in milliseconds) this backend will wait for a file lock.
|
cachingAllowed, DEFAULTFACTORY, name, scheme, validateHeader
Constructor and Description |
---|
RrdSafeFileBackendFactory()
Generate a factory using the default system wide lock settings
|
RrdSafeFileBackendFactory(long lockWaitTime,
long lockRetryPeriod)
Generate a factory with custom lock settings
|
Modifier and Type | Method and Description |
---|---|
static long |
getLockRetryPeriod()
Returns time between two consecutive file locking attempts.
|
static long |
getLockWaitTime()
Returns time this backend will wait for a file lock.
|
protected RrdBackend |
open(String path,
boolean readOnly)
Creates RrdFileBackend object for the given file path.
|
static void |
setLockRetryPeriod(long lockRetryPeriod)
Sets time between two consecutive file locking attempts.
|
static void |
setLockWaitTime(long lockWaitTime)
Sets time this backend will wait for a file lock.
|
canStore, exists, getCanonicalUri, getPath, getUri
addActiveFactories, addFactories, buildGenericUri, checkClosing, close, exists, findFactory, getActiveFactories, getBackend, getBackend, getDefaultFactory, getFactory, getName, getRootUri, getScheme, registerAndSetAsDefaultFactory, registerFactory, resolve, setActiveFactories, setDefaultFactory, shouldValidateHeader, shouldValidateHeader
public static final long LOCK_WAIT_TIME
public static final long LOCK_RETRY_PERIOD
public RrdSafeFileBackendFactory()
public RrdSafeFileBackendFactory(long lockWaitTime, long lockRetryPeriod)
lockWaitTime
- wait time in mslockRetryPeriod
- retry period in msprotected RrdBackend open(String path, boolean readOnly) throws IOException
open
in class RrdRandomAccessFileBackendFactory
IOException
public static long getLockWaitTime()
public static void setLockWaitTime(long lockWaitTime)
lockWaitTime
- Maximum lock wait time (in milliseconds)public static long getLockRetryPeriod()
public static void setLockRetryPeriod(long lockRetryPeriod)
lockRetryPeriod
- time (in milliseconds) between two consecutive file locking attempts.