类 IndustrialHashMap<K,V>

java.lang.Object
com.tlcsdm.core.concurrent.IndustrialHashMap<K,V>

public class IndustrialHashMap<K,V> extends Object
线程安全HashMap实现 特性: 1. 分段锁机制,减少锁竞争 2. 读写分离,读操作无锁化 3. 自适应扩容和缩容 4. 防止hash碰撞攻击 5. 内存泄漏保护 6. 性能监控和降级机制
作者:
unknowIfGuestInDream
  • 字段详细资料

    • DEFAULT_INITIAL_CAPACITY

      private static final int DEFAULT_INITIAL_CAPACITY
      另请参阅:
    • DEFAULT_CONCURRENCY_LEVEL

      private static final int DEFAULT_CONCURRENCY_LEVEL
      另请参阅:
    • DEFAULT_LOAD_FACTOR

      private static final float DEFAULT_LOAD_FACTOR
      另请参阅:
    • MAXIMUM_CAPACITY

      private static final int MAXIMUM_CAPACITY
      另请参阅:
    • MAX_SEGMENTS

      private static final int MAX_SEGMENTS
      另请参阅:
    • collisionCount

      private final AtomicInteger collisionCount
    • resizeCount

      private final AtomicInteger resizeCount
    • lastCleanupTime

      private volatile long lastCleanupTime
    • segments

      private final IndustrialHashMap.Segment<K,V>[] segments
    • segmentShift

      private final int segmentShift
    • segmentMask

      private final int segmentMask
    • hashSeed

      private final int hashSeed
  • 构造器详细资料

    • IndustrialHashMap

      public IndustrialHashMap()
    • IndustrialHashMap

      public IndustrialHashMap(int initialCapacity)
    • IndustrialHashMap

      public IndustrialHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)
  • 方法详细资料

    • hash

      private int hash(Object key)
    • segmentFor

      private IndustrialHashMap.Segment<K,V> segmentFor(int hash)
    • get

      public V get(Object key)
    • put

      public V put(K key, V value)
    • putIfAbsent

      public V putIfAbsent(K key, V value)
    • remove

      public V remove(Object key)
    • remove

      public boolean remove(Object key, Object value)
    • replace

      public V replace(K key, V value)
    • replace

      public boolean replace(K key, V oldValue, V newValue)
    • containsKey

      public boolean containsKey(Object key)
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • clear

      public void clear()
    • compute

      public V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
    • getCollisionCount

      public long getCollisionCount()
    • getResizeCount

      public long getResizeCount()
    • printStatistics

      public void printStatistics()
    • startCleanupThread

      private void startCleanupThread()
    • performCleanup

      private void performCleanup()
    • keyIterator

      public Iterator<K> keyIterator()