org.rrd4j.core
Class RrdSafeFileBackendFactory

java.lang.Object
  extended by org.rrd4j.core.RrdBackendFactory
      extended by org.rrd4j.core.RrdFileBackendFactory
          extended by org.rrd4j.core.RrdRandomAccessFileBackendFactory
              extended by org.rrd4j.core.RrdSafeFileBackendFactory

public class RrdSafeFileBackendFactory
extends RrdRandomAccessFileBackendFactory

Factory class which creates actual RrdSafeFileBackend objects.


Field Summary
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.
 
Constructor Summary
RrdSafeFileBackendFactory()
           
 
Method Summary
static long getLockRetryPeriod()
          Returns time between two consecutive file locking attempts.
static long getLockWaitTime()
          Returns time this backend will wait for a file lock.
 String getName()
          Returns the name (primary ID) for the factory.
protected  RrdBackend open(String path, boolean readOnly)
          Creates RrdSafeFileBackend 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.
 
Methods inherited from class org.rrd4j.core.RrdRandomAccessFileBackendFactory
exists, shouldValidateHeader
 
Methods inherited from class org.rrd4j.core.RrdBackendFactory
getDefaultFactory, getFactory, registerAndSetAsDefaultFactory, registerFactory, setDefaultFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

RrdSafeFileBackendFactory

public RrdSafeFileBackendFactory()
Method Detail

open

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

Overrides:
open in class RrdRandomAccessFileBackendFactory
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.

getName

public String getName()
Description copied from class: RrdBackendFactory
Returns the name (primary ID) for the factory.

Overrides:
getName in class RrdRandomAccessFileBackendFactory
Returns:
Name of the factory.

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.


Copyright © 2011. All Rights Reserved.