Class JCasHashMapSubMap

java.lang.Object
org.apache.uima.jcas.impl.JCasHashMapSubMap

class JCasHashMapSubMap extends Object
  • Field Details

    • TUNE

      private static final boolean TUNE
      See Also:
    • PROBE_ADDR_INDEX

      private static final int PROBE_ADDR_INDEX
      See Also:
    • PROBE_DELTA_INDEX

      private static final int PROBE_DELTA_INDEX
      See Also:
    • RESERVE_TOP_TYPE_INSTANCE

      static final TOP_Type RESERVE_TOP_TYPE_INSTANCE
    • probeInfoGet

      static final ThreadLocal<int[]> probeInfoGet
    • probeInfoPut

      static final ThreadLocal<int[]> probeInfoPut
    • probeInfoPutInner

      static final ThreadLocal<int[]> probeInfoPutInner
    • histogram

      int[] histogram
    • maxProbe

      int maxProbe
    • maxProbeAfterContinue

      int maxProbeAfterContinue
    • continues

      int continues
    • lock

      private final ReentrantLock lock
    • lockCondition

      private final Condition lockCondition
    • sizeWhichTriggersExpansion

      private int sizeWhichTriggersExpansion
    • size

      int size
    • table

      volatile FeatureStructureImpl[] table
    • secondTimeShrinkable

      private boolean secondTimeShrinkable
    • loadFactor

      private final float loadFactor
    • subMapInitialCapacity

      private final int subMapInitialCapacity
    • concurrencyLevelBits

      private final int concurrencyLevelBits
  • Constructor Details

    • JCasHashMapSubMap

      JCasHashMapSubMap(float loadFactor, int subMapInitialCapacity, int concurrencyLevelBits)
  • Method Details

    • newTable

      private JCasHashMapSubMap newTable(int capacity)
    • newTableKeepSize

      private FeatureStructureImpl[] newTableKeepSize(int capacity)
    • incrementSize

      private void incrementSize()
    • clear

      void clear()
    • find

      private FeatureStructureImpl find(FeatureStructureImpl[] localTable, int key, int hash, int[] probeInfo)
      Can be called under lock or not. It gets a ref to the current value of table, and then searches that int array. If, during the search, the table is resized, it continues using the ** before the resize ** int array referenced by localTable The answer will only be OK if the key is found for a real value. Results that yield null or Reserved slots must be re-searched, under a lock (caller needs to do this).
      Parameters:
      key - -
      hash - -
      probeInfo - - used to get/receive multiple int values; 0: (in/out) startProbe or -1, 1: (in/out) probeDelta (starts at 1)
      Returns:
      the probeAddr in original table (which might have been resized)
    • find2

      private FeatureStructureImpl find2(FeatureStructureImpl[] localTable, int key, int[] probeInfo, int probeAddr)
    • updateHistogram

      private void updateHistogram(int nbrProbes, boolean isContinue)
    • getReserve

      FeatureStructureImpl getReserve(int key, int hash)
      Gets a value, but if the value isn't there, it reserves the slot where it will go with a new instance where the key matches, but the type is a unique value. Threading: not synchronized for main path where get is finding an element. Since elements are never updated, there is no race if an element is found. And it doesn't matter if the table is resized (if the element is found). If it is not found, or a reserve is found, need to get the lock, and start over if resized, or continue from reserved or null spot if not
      Parameters:
      key - - the addr in the heap
      hash - - the hash that was already computed from the key
      Returns:
      - the found fs, or null
    • put

      FeatureStructureImpl put(int key, FeatureStructureImpl value, int hash)
    • putInner

      private void putInner(int key, FeatureStructureImpl value, int hash)
      Only used to fill in newly expanded table always called with lock held
      Parameters:
      key - -
      value - -
      hash - -
    • increaseTableCapacity

      private void increaseTableCapacity()
    • isReserve

      private static boolean isReserve(FeatureStructureImpl m)
    • isReal

      private static boolean isReal(FeatureStructureImpl m)
    • resetProbeInfo

      private static void resetProbeInfo(int[] probeInfo)
    • setProbeInfo

      private static void setProbeInfo(int[] probeInfo, int probeAddr, int probeDelta)