Class InMemoryMessageListStore<K,​M extends PMessage<M>>

  • Type Parameters:
    K - The key type.
    M - The stored message type.
    All Implemented Interfaces:
    MessageListReadOnlyStore<K,​M>, MessageListStore<K,​M>, ReadOnlyStore<K,​java.util.List<M>>, ReadWriteStore<K,​java.util.List<M>>

    public class InMemoryMessageListStore<K,​M extends PMessage<M>>
    extends java.lang.Object
    implements MessageListStore<K,​M>
    Simple in-memory storage of lists providence messages. Uses a local hash map for storing the instances.The store is thread safe through using reentrand read-write mutex handling, so reading can happen in parallel.
    • Constructor Detail

      • InMemoryMessageListStore

        public InMemoryMessageListStore()
    • Method Detail

      • getAll

        @Nonnull
        public java.util.Map<K,​java.util.List<M>> getAll​(@Nonnull
                                                               java.util.Collection<K> keys)
        Description copied from interface: ReadOnlyStore
        Look up a set of keys from the storage.
        Specified by:
        getAll in interface ReadOnlyStore<K,​M extends PMessage<M>>
        Parameters:
        keys - The keys to look up.
        Returns:
        Map of all the found key value pairs. Values not found should not have an entry in the result map (no key -> null mapping).
      • containsKey

        public boolean containsKey​(@Nonnull
                                   K key)
        Specified by:
        containsKey in interface ReadOnlyStore<K,​M extends PMessage<M>>
        Parameters:
        key - The key to look up.
        Returns:
        True if the key was contained in the map.
      • keys

        @Nonnull
        public java.util.Collection<K> keys()
        Description copied from interface: ReadOnlyStore
        Get a collection of all the keys in the store.
        Specified by:
        keys in interface ReadOnlyStore<K,​M extends PMessage<M>>
        Returns:
        Key collection.
      • size

        public int size()
        Specified by:
        size in interface ReadOnlyStore<K,​M extends PMessage<M>>
        Returns:
        Get the total number of entries in the store, same as the number of unique keys.
      • putAll

        public void putAll​(@Nonnull
                           java.util.Map<K,​java.util.List<M>> values)
        Specified by:
        putAll in interface ReadWriteStore<K,​M extends PMessage<M>>
        Parameters:
        values - Put all key value pairs form this map into the storage.
      • removeAll

        public void removeAll​(java.util.Collection<K> keys)
        Description copied from interface: ReadWriteStore
        Remove the values for the given keys.
        Specified by:
        removeAll in interface ReadWriteStore<K,​M extends PMessage<M>>
        Parameters:
        keys - Map of removed key value pairs.