org.jrobin.core

Class RrdSafeFileBackendFactory

public class RrdSafeFileBackendFactory extends RrdFileBackendFactory

Factory class which creates actual RrdSafeFileBackend objects.
Field Summary
static longLOCK_RETRY_PERIOD
Default time between two consecutive file locking attempts.
static longLOCK_WAIT_TIME
Default time (in milliseconds) this backend will wait for a file lock.
static StringNAME
factory name, "SAFE"
Method Summary
StringgetFactoryName()
Returns the name of this factory.
static longgetLockRetryPeriod()
Returns time between two consecutive file locking attempts.
static longgetLockWaitTime()
Returns time this backend will wait for a file lock.
protected RrdBackendopen(String path, boolean readOnly)
Creates RrdSafeFileBackend object for the given file path.
static voidsetLockRetryPeriod(long lockRetryPeriod)
Sets time between two consecutive file locking attempts.
static voidsetLockWaitTime(long lockWaitTime)
Sets time this backend will wait for a file lock.

Field Detail

LOCK_RETRY_PERIOD

public static final long LOCK_RETRY_PERIOD
Default time between two consecutive file locking attempts.

LOCK_WAIT_TIME

public static final long LOCK_WAIT_TIME
Default time (in milliseconds) this backend will wait for a file lock.

NAME

public static final String NAME
factory name, "SAFE"

Method Detail

getFactoryName

public String getFactoryName()
Returns the name of this factory.

Returns: Factory name (equals to string "SAFE")

getLockRetryPeriod

public static long getLockRetryPeriod()
Returns time between two consecutive file locking attempts.

Returns: Time (im milliseconds) between two consecutive file locking attempts.

getLockWaitTime

public static long getLockWaitTime()
Returns time this backend will wait for a file lock.

Returns: Time (in milliseconds) this backend will wait for a file lock.

open

protected RrdBackend open(String path, boolean readOnly)
Creates RrdSafeFileBackend object for the given file path.

Parameters: path File path readOnly This parameter is ignored

Returns: RrdSafeFileBackend object which handles all I/O operations for the given file path

Throws: IOException Thrown in case of I/O error.

setLockRetryPeriod

public static void setLockRetryPeriod(long lockRetryPeriod)
Sets time between two consecutive file locking attempts.

Parameters: lockRetryPeriod time (in milliseconds) between two consecutive file locking attempts.

setLockWaitTime

public static void setLockWaitTime(long lockWaitTime)
Sets time this backend will wait for a file lock.

Parameters: lockWaitTime Maximum lock wait time (in milliseconds)