public class RrdNioBackendFactory extends RrdFileBackendFactory
RrdNioBackend
objects. This is the default factory since
1.4.0 version.
RrdSyncThreadPool
, which it uses to sync the memory-mapped files to
disk. In order to avoid having these threads live longer than they should, it is recommended that clients create and
destroy thread pools at the appropriate time in their application's life time. Failure to manage thread pools
appropriately may lead to the thread pool hanging around longer than necessary, which in turn may cause memory leaks.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SYNC_CORE_POOL_SIZE
The core pool size for the sync executor.
|
static int |
DEFAULT_SYNC_PERIOD
Period in seconds between consecutive synchronizations when
sync-mode is set to SYNC_BACKGROUND.
|
Constructor and Description |
---|
RrdNioBackendFactory()
Creates a new RrdNioBackendFactory.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
getName.
|
static int |
getSyncPeriod()
Returns time between two consecutive background synchronizations.
|
static int |
getSyncPoolSize()
Returns the number of synchronizing threads.
|
protected RrdBackend |
open(String path,
boolean readOnly)
Creates RrdBackend object for the given storage path.
|
static void |
setSyncPeriod(int syncPeriod)
Sets time between consecutive background synchronizations.
|
static void |
setSyncPoolSize(int syncPoolSize)
Sets the number of synchronizing threads.
|
void |
setSyncThreadPool(RrdSyncThreadPool syncThreadPool)
Setter for the field
syncThreadPool . |
void |
setSyncThreadPool(ScheduledExecutorService syncThreadPool)
Setter for the field
syncThreadPool . |
exists, shouldValidateHeader
getDefaultFactory, getFactory, registerAndSetAsDefaultFactory, registerFactory, setDefaultFactory
public static final int DEFAULT_SYNC_PERIOD
setSyncPeriod(int)
method.public static final int DEFAULT_SYNC_CORE_POOL_SIZE
public RrdNioBackendFactory()
setSyncThreadPool(RrdSyncThreadPool syncThreadPool)
or setSyncThreadPool(RrdSyncThreadPool syncThreadPool)
before the first call to
open(String path, boolean readOnly)
.
Failure to do so will lead to memory leaks in anything but the simplest applications because the underlying thread pool will not
be shut down cleanly. Read the Javadoc for this class to understand why using this constructor is discouraged.
public static int getSyncPeriod()
setSyncPeriod(int)
method call, defaults to DEFAULT_SYNC_PERIOD
.
See setSyncPeriod(int)
for more information.public static void setSyncPeriod(int syncPeriod)
syncPeriod
- Time in seconds between consecutive background synchronizations.public static int getSyncPoolSize()
setSyncPoolSize(int)
method call, defaults to DEFAULT_SYNC_CORE_POOL_SIZE
.
See setSyncPoolSize(int)
for more information.public static void setSyncPoolSize(int syncPoolSize)
syncPoolSize
- Number of synchronizing threads.public void setSyncThreadPool(RrdSyncThreadPool syncThreadPool)
Setter for the field syncThreadPool
.
syncThreadPool
- the RrdSyncThreadPool to use to sync the memory-mapped files.public void setSyncThreadPool(ScheduledExecutorService syncThreadPool)
Setter for the field syncThreadPool
.
syncThreadPool
- the ScheduledExecutorService that will back the RrdSyncThreadPool used to sync the memory-mapped files.protected RrdBackend open(String path, boolean readOnly) throws IOException
open
in class RrdBackendFactory
path
- Storage pathreadOnly
- True, if the storage should be accessed in read/only mode.
False otherwise.IOException
- Thrown in case of I/O error.public String getName()
getName.
getName
in class RrdBackendFactory
String
"NIO".Copyright © 2015. All rights reserved.