Class RrdNioBackend

  • All Implemented Interfaces:
    RrdFileBackend

    public class RrdNioBackend
    extends ByteBufferBackend
    implements RrdFileBackend
    Backend which is used to store RRD data to ordinary disk files using java.nio.* package. This is the default backend engine.
    • Constructor Detail

      • RrdNioBackend

        protected RrdNioBackend​(String path,
                                boolean readOnly,
                                RrdSyncThreadPool threadPool,
                                int syncPeriod)
                         throws IOException
        Creates RrdFileBackend object for the given file path, backed by java.nio.* classes.
        Parameters:
        path - Path to a file
        readOnly - True, if file should be open in a read-only mode. False otherwise
        syncPeriod - See RrdNioBackendFactory.setSyncPeriod(int) for explanation
        threadPool - a RrdSyncThreadPool object, it can be null.
        Throws:
        IOException - Thrown in case of I/O error
    • Method Detail

      • setLength

        protected void setLength​(long newLength)
                          throws IOException
        Sets the number of bytes in the underlying RRD storage. This method is called only once, immediately after a new RRD storage gets created. Sets length of the underlying RRD file. This method is called only once, immediately after a new RRD file gets created.
        Specified by:
        setLength in class RrdBackend
        Parameters:
        newLength - Length of the underlying RRD storage in bytes.
        Throws:
        IllegalArgumentException - if the length is bigger that the possible mapping position (2GiB).
        IOException - Thrown in case of I/O error.
      • sync

        protected void sync()
        This method forces all data cached in memory but not yet stored in the file, to be stored in it.
      • getLength

        public long getLength()
                       throws IOException
        Description copied from class: RrdBackend
        Returns the number of RRD bytes in the underlying storage.
        Specified by:
        getLength in class RrdBackend
        Returns:
        Number of RRD bytes in the storage.
        Throws:
        IOException - Thrown in case of I/O error.