Interface QueueStore<T>

  • Type Parameters:
    T - queue item type

    public interface QueueStore<T>
    QueueStore makes a queue backed by a central data store; such as database, disk, etc.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void delete​(java.lang.Long key)
      Deletes the entry with a given key from the store.
      void deleteAll​(java.util.Collection<java.lang.Long> keys)
      Deletes multiple entries from the store.
      T load​(java.lang.Long key)
      Loads the value of a given key.
      java.util.Map<java.lang.Long,​T> loadAll​(java.util.Collection<java.lang.Long> keys)
      Loads the given keys.
      java.util.Set<java.lang.Long> loadAllKeys()
      Loads all of the keys from the store.
      void store​(java.lang.Long key, T value)
      Stores the key-value pair.
      void storeAll​(java.util.Map<java.lang.Long,​T> map)
      Stores multiple entries.
    • Method Detail

      • store

        void store​(java.lang.Long key,
                   T value)
        Stores the key-value pair.
        Parameters:
        key - key of the entry to store
        value - value of the entry to store
      • storeAll

        void storeAll​(java.util.Map<java.lang.Long,​T> map)
        Stores multiple entries. Implementation of this method can optimize the store operation by storing all entries in one database connection for instance.
        Parameters:
        map - map of entries to store
      • delete

        void delete​(java.lang.Long key)
        Deletes the entry with a given key from the store.
        Parameters:
        key - key to delete from the store.
      • deleteAll

        void deleteAll​(java.util.Collection<java.lang.Long> keys)
        Deletes multiple entries from the store.
        Parameters:
        keys - keys of the entries to delete.
      • load

        T load​(java.lang.Long key)
        Loads the value of a given key.

        Implementation can use any means of loading the given key; such as an O/R mapping tool, simple SQL, reading a file, etc.

        Parameters:
        key - the key of the requested value
        Returns:
        value of the key
      • loadAll

        java.util.Map<java.lang.Long,​T> loadAll​(java.util.Collection<java.lang.Long> keys)
        Loads the given keys. This is a batch load operation so that implementation can optimize the multiple loads.

        Set the bulk-load property to configure batch loading. When the queue is initialized, items are loaded from QueueStore in bulks. Bulk load is the size of these bulks. The default value of bulk-load is 250.

        Parameters:
        keys - keys of the value entries to load
        Returns:
        map of loaded key-value pairs. May return null if no values loaded.
      • loadAllKeys

        java.util.Set<java.lang.Long> loadAllKeys()
        Loads all of the keys from the store.

        The items identified by the keys will be loaded in the iteration order of the returned Set

        Returns:
        all the keys from the store. May return null if no keys loaded.