Package org.jrobin.core
Class RrdSafeFileBackendFactory
- java.lang.Object
-
- org.jrobin.core.RrdBackendFactory
-
- org.jrobin.core.RrdFileBackendFactory
-
- org.jrobin.core.RrdSafeFileBackendFactory
-
public class RrdSafeFileBackendFactory extends RrdFileBackendFactory
Factory class which creates actualRrdSafeFileBackendobjects.
-
-
Field Summary
Fields Modifier and Type Field Description static longLOCK_RETRY_PERIODDefault time between two consecutive file locking attempts.static longLOCK_WAIT_TIMEDefault time (in milliseconds) this backend will wait for a file lock.static StringNAMEfactory name, "SAFE"
-
Constructor Summary
Constructors Constructor Description RrdSafeFileBackendFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.-
Methods inherited from class org.jrobin.core.RrdFileBackendFactory
exists
-
Methods inherited from class org.jrobin.core.RrdBackendFactory
getDefaultFactory, getFactory, isInstanceCreated, registerAndSetAsDefaultFactory, registerFactory, setDefaultFactory, toString
-
-
-
-
Field Detail
-
LOCK_WAIT_TIME
public static final long LOCK_WAIT_TIME
Default time (in milliseconds) this backend will wait for a file lock.- See Also:
- Constant Field Values
-
LOCK_RETRY_PERIOD
public static final long LOCK_RETRY_PERIOD
Default time between two consecutive file locking attempts.- See Also:
- Constant Field Values
-
NAME
public static final String NAME
factory name, "SAFE"- See Also:
- Constant Field Values
-
-
Method Detail
-
open
protected RrdBackend open(String path, boolean readOnly) throws IOException
Creates RrdSafeFileBackend object for the given file path.- Overrides:
openin classRrdFileBackendFactory- Parameters:
path- File pathreadOnly- 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.
-
getFactoryName
public String getFactoryName()
Returns the name of this factory.- Overrides:
getFactoryNamein classRrdFileBackendFactory- Returns:
- Factory name (equals to string "SAFE")
-
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.
-
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)
-
getLockRetryPeriod
public static long getLockRetryPeriod()
Returns time between two consecutive file locking attempts.- Returns:
- Time (im milliseconds) between two consecutive file locking attempts.
-
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.
-
-