Interface Registry

All Known Implementing Classes:
BasicRegistry

public interface Registry
A variable store for sharing common values across all nodes in a cluster.

For example the PDF key and URI might be put in this registry. Also queue length perhaps.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check if something is registered for the key.
    void
    Delete the given key.
    org.json.JSONObject
    Get a json object from the registry.
    Get a number from the registry.
    Get string from the registry.
    long
    Return the amount of time the registry will keep an entry before purging the record.
    Get a URI from the registry.
    int
    incrementInt(String key, int amount)
    Increment the value currently stored in the registry by the amount.
    long
    incrementLong(String key, long amount)
    Increment the value currently stored in the registry by the amount.
    <T> T
    opt(String key, T defaultValue)
    Get a value from the registry or return the default if the value is not in the registry.
    void
    put(String key, Number value)
    Put a number in the registry.
    void
    put(String key, String value)
    Put a string in the registry.
    void
    put(String key, URI value)
    Put a URI in the registry.
    void
    put(String key, org.json.JSONObject value)
    Put a json object in the registry.
  • Method Details

    • containsKey

      boolean containsKey(String key)
      Check if something is registered for the key.
      Parameters:
      key - key to check for
    • put

      void put(String key, URI value)
      Put a URI in the registry.
      Parameters:
      key - the key of the entry
      value - the value
    • getURI

      URI getURI(String key)
      Get a URI from the registry.
      Parameters:
      key - the key to use for lookup.
    • put

      void put(String key, String value)
      Put a string in the registry.
      Parameters:
      key - the key of the entry
      value - the value
    • getString

      String getString(String key)
      Get string from the registry.
      Parameters:
      key - the key to use for lookup.
    • put

      void put(String key, Number value)
      Put a number in the registry.
      Parameters:
      key - the key of the entry
      value - the value
    • getNumber

      Number getNumber(String key)
      Get a number from the registry.
      Parameters:
      key - the number
    • opt

      <T> T opt(String key, T defaultValue)
      Get a value from the registry or return the default if the value is not in the registry.
      Type Parameters:
      T - the type of the returned object
      Parameters:
      key - the key of the element to the key to use for lookup.
      defaultValue - the value to return if a value with the key is not in the registry
    • put

      void put(String key, org.json.JSONObject value)
      Put a json object in the registry.
      Parameters:
      key - the key of the entry
      value - the value
    • getJSON

      org.json.JSONObject getJSON(String key)
      Get a json object from the registry.
      Parameters:
      key - the key use for lookup
    • incrementInt

      int incrementInt(String key, int amount)
      Increment the value currently stored in the registry by the amount. This assumes it is an integer.

      If there is not value present in registry then a value will be registered as amount.

      Parameters:
      key - the key of the element to increment
      amount - th amount to increment
      Returns:
      the new value
    • incrementLong

      long incrementLong(String key, long amount)
      Increment the value currently stored in the registry by the amount. This assumes it is an long.

      If there is not value present in registry then a value will be registered as amount.

      Parameters:
      key - the key of the element to increment
      amount - the amount to increment
      Returns:
      the new value
    • getTimeToKeepAfterAccessInMillis

      long getTimeToKeepAfterAccessInMillis()
      Return the amount of time the registry will keep an entry before purging the record. This ability to purge old records prevents the registry from growing in size indefinitely.
      Returns:
      the number of milliseconds between the last access of a record and the time when a record can be purged from the registry.
    • delete

      void delete(String key)
      Delete the given key.
      Parameters:
      key - the key to delete.