org.rrd4j.core

## Class RrdMemoryBackendFactory

- java.lang.Object
- - org.rrd4j.core.RrdBackendFactory
  - - org.rrd4j.core.RrdMemoryBackendFactory

- All Implemented Interfaces:
    Closeable, AutoCloseable

      @RrdBackendAnnotation(name="MEMORY",
                            shouldValidateHeader=false)
      public class RrdMemoryBackendFactory
      extends RrdBackendFactory

  Factory class which creates actual `RrdMemoryBackend` objects. Rrd4j's support for in-memory RRDs is still experimental. You should know that all active RrdMemoryBackend objects are held in memory, each backend object stores RRD data in one big byte array. This implementation is therefore quite basic and memory hungry but runs very fast.

  Calling `close()` on RrdDb objects does not release any memory at all (RRD data must be available for the next `new RrdDb(path)` call. To release allocated memory, you'll have to call `delete(path)` method of this class.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,AtomicReference<ByteBuffer>>` | `backends`

    - ### Fields inherited from class org.rrd4j.core.RrdBackendFactory

      `cachingAllowed, DEFAULTFACTORY, name, scheme, validateHeader`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RrdMemoryBackendFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canStore(URI uri)`
    `boolean` | `delete(String id)` Removes the storage with the given ID from the memory.
    `protected boolean` | `exists(String id)` Determines if a storage with the given path already exists.
    `protected RrdBackend` | `open(String id, boolean readOnly)`

    - ### Methods inherited from class org.rrd4j.core.RrdBackendFactory

      `addActiveFactories, buildGenericUri, checkClosing, close, exists, findFactory, getActiveFactories, getBackend, getBackend, getCanonicalUri, getDefaultFactory, getName, getPath, getRootUri, getScheme, getUri, resolve, setActiveFactories, shouldValidateHeader, shouldValidateHeader`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### backends

          protected final Map<String,AtomicReference<ByteBuffer>> backends

  - ### Constructor Detail

    - #### RrdMemoryBackendFactory

          public RrdMemoryBackendFactory()

  - ### Method Detail

    - #### canStore

          public boolean canStore(URI uri)

      Overrides:
        `canStore` in class `RrdBackendFactory`

    - #### delete

          public boolean delete(String id)

      Removes the storage with the given ID from the memory.
      Parameters:
        `id` - Storage ID
      Returns:
        a boolean.

    - #### exists

          protected boolean exists(String id)

      Determines if a storage with the given path already exists.

      Method to determine if a memory storage with the given ID already exists.

      Specified by:
        `exists` in class `RrdBackendFactory`
      Parameters:
        `id` - Storage path
      Returns:
        a boolean.

    - #### open

          protected RrdBackend open(String id,
                                    boolean readOnly)

      Creates RrdMemoryBackend object.

      Specified by:
        `open` in class `RrdBackendFactory`