Class RrdNioBackendFactory

All Implemented Interfaces:
Closeable, AutoCloseable

@RrdBackendAnnotation(name="NIO",
                      shouldValidateHeader=true)
public class RrdNioBackendFactory
extends RrdFileBackendFactory
Factory class which creates actual RrdNioBackend objects. This is the default factory since 1.4.0 version.

Managing the thread pool

Each RrdNioBackendFactory is optionally backed by a 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.

if sync period is negative, no sync thread will be launched

  • Field Details

  • Constructor Details

    • RrdNioBackendFactory

      public RrdNioBackendFactory()
      Creates a new RrdNioBackendFactory with default settings.
    • RrdNioBackendFactory

      public RrdNioBackendFactory​(int syncPeriod)
      Creates a new RrdNioBackendFactory, using a default RrdSyncThreadPool.
      Parameters:
      syncPeriod - the sync period, in seconds. If negative or 0, sync threads are disabled.
    • RrdNioBackendFactory

      public RrdNioBackendFactory​(int syncPeriod, int syncPoolSize)
      Creates a new RrdNioBackendFactory.
      Parameters:
      syncPeriod - the sync period, in seconds.
      syncPoolSize - The number of threads to use to sync the mapped file to disk, if negative or 0, sync threads are disabled.
    • RrdNioBackendFactory

      public RrdNioBackendFactory​(int syncPeriod, ScheduledExecutorService syncThreadPool)
      Creates a new RrdNioBackendFactory.
      Parameters:
      syncPeriod - the sync period, in seconds.
      syncThreadPool - If null, disable background sync threads
    • RrdNioBackendFactory

      public RrdNioBackendFactory​(int syncPeriod, RrdSyncThreadPool syncThreadPool)
      Creates a new RrdNioBackendFactory.
      Parameters:
      syncPeriod - the sync period, in seconds.
      syncThreadPool - If null, disable background sync threads
  • Method Details