Class SynchronizedHashMultiMap<K,V>

java.lang.Object
org.apache.bookkeeper.util.collections.SynchronizedHashMultiMap<K,V>

public class SynchronizedHashMultiMap<K,V> extends Object
Simple multimap implementation that only stores key reference once.

Implementation is aimed at storing PerChannelBookieClient completions when there are duplicates. If the key is a pooled object, it must not exist once the value has been removed from the map, which can happen with guava multimap implementations.

With this map is implemented with pretty heavy locking, but this shouldn't be an issue as the multimap only needs to be used in rare cases, i.e. when a user tries to read or the same entry twice at the same time. This class should *NOT* be used in critical path code.

A unique key-value pair will only be stored once.

  • Field Details

  • Constructor Details

    • SynchronizedHashMultiMap

      public SynchronizedHashMultiMap()
  • Method Details

    • put

      public void put(K k, V v)
    • getAnyKey

      public Optional<K> getAnyKey()
    • removeAny

      public Optional<V> removeAny(K k)
    • removeIf

      public int removeIf(BiPredicate<K,V> predicate)