Class GridBoundedConcurrentLinkedHashMap<K,​V>

  • Type Parameters:
    K - Map key.
    V - Map entry.
    All Implemented Interfaces:
    ConcurrentMap<K,​V>, Map<K,​V>

    public class GridBoundedConcurrentLinkedHashMap<K,​V>
    extends ConcurrentLinkedHashMap<K,​V>
    Concurrent map with an upper bound. Once map reaches its maximum capacity, the eldest elements will be removed based on insertion order.
    • Constructor Detail

      • GridBoundedConcurrentLinkedHashMap

        public GridBoundedConcurrentLinkedHashMap​(int max)
        Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16).
        Parameters:
        max - Upper bound of this map.
      • GridBoundedConcurrentLinkedHashMap

        public GridBoundedConcurrentLinkedHashMap​(int max,
                                                  int initCap)
        Creates a new, empty map with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).
        Parameters:
        max - Upper bound of this map.
        initCap - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        Throws:
        IllegalArgumentException - if the initial capacity of elements is negative.
      • GridBoundedConcurrentLinkedHashMap

        public GridBoundedConcurrentLinkedHashMap​(int max,
                                                  int initCap,
                                                  float loadFactor)
        Creates a new, empty map with the specified initial capacity and load factor and with the default concurrencyLevel (16).
        Parameters:
        max - Upper bound of this map.
        initCap - The implementation performs internal sizing to accommodate this many elements.
        loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
        Throws:
        IllegalArgumentException - if the initial capacity of elements is negative or the load factor is nonpositive.
      • GridBoundedConcurrentLinkedHashMap

        public GridBoundedConcurrentLinkedHashMap​(int max,
                                                  int initCap,
                                                  float loadFactor,
                                                  int concurLvl)
        Creates a new, empty map with the specified initial capacity, load factor and concurrency level.
        Parameters:
        max - Upper bound of this map.
        initCap - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
        concurLvl - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
        Throws:
        IllegalArgumentException - if the initial capacity is negative or the load factor or concurLvl are nonpositive.
      • GridBoundedConcurrentLinkedHashMap

        public GridBoundedConcurrentLinkedHashMap​(int max,
                                                  int initCap,
                                                  float loadFactor,
                                                  int concurLvl,
                                                  ConcurrentLinkedHashMap.QueuePolicy qPlc)
        Creates a new, empty map with the specified initial capacity, load factor and concurrency level.
        Parameters:
        max - Upper bound of this map.
        initCap - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
        concurLvl - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
        qPlc - Queue policy.
        Throws:
        IllegalArgumentException - if the initial capacity is negative or the load factor or concurLvl are nonpositive.