Class DecoratorReadWriteLockReverseMap<K,V>

Type Parameters:
K - The type of key used in the map.
V - The type of value stored in the map.
All Implemented Interfaces:
ReadWriteLockMap<K,V>, ReadWriteLockReverseMap<K,V>, ReverseMap<K,V>, ReadWriteLock, Map<K,V>

public class DecoratorReadWriteLockReverseMap<K,V> extends DecoratorReadWriteLockMap<K,V> implements ReadWriteLockReverseMap<K,V>
A thread-safe map decorator that allows many readers but only one writer to access a map at a time, and that also allows lookup of the map keys keyed to the values by decorating two maps. For operations that iterate over live map data, a read or write lock should be acquired before the call to acquire the data and held until the data is consumed.
Author:
Garret Wilson
  • Constructor Details

    • DecoratorReadWriteLockReverseMap

      public DecoratorReadWriteLockReverseMap(Map<K,V> map, Map<V,K> reverseMap)
      Map constructor with a default reentrant read/write lock.
      Parameters:
      map - The map this map should decorate.
      reverseMap - The map to contain reverse lookup values.
      Throws:
      NullPointerException - if the provided map and/or reverse map is null.
    • DecoratorReadWriteLockReverseMap

      public DecoratorReadWriteLockReverseMap(Map<K,V> map, Map<V,K> reverseMap, ReadWriteLock lock)
      Map and read/write lock constructor.
      Parameters:
      map - The map this map should decorate.
      reverseMap - The map to contain reverse lookup values.
      lock - The lock for controlling access to the map.
      Throws:
      NullPointerException - if the provided map, reverse map, and/or lock is null.
  • Method Details