Package org.apache.uima.jcas.impl
Class JCasHashMapSubMap
java.lang.Object
org.apache.uima.jcas.impl.JCasHashMapSubMap
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
(package private) int
(package private) int[]
private final float
private final ReentrantLock
private final Condition
(package private) int
(package private) int
private static final int
private static final int
(package private) static final ThreadLocal
<int[]> (package private) static final ThreadLocal
<int[]> (package private) static final ThreadLocal
<int[]> (package private) static final TOP_Type
private boolean
(package private) int
private int
private final int
(package private) FeatureStructureImpl[]
private static final boolean
-
Constructor Summary
ConstructorsConstructorDescriptionJCasHashMapSubMap
(float loadFactor, int subMapInitialCapacity, int concurrencyLevelBits) -
Method Summary
Modifier and TypeMethodDescription(package private) void
clear()
private FeatureStructureImpl
find
(FeatureStructureImpl[] localTable, int key, int hash, int[] probeInfo) Can be called under lock or not.private FeatureStructureImpl
find2
(FeatureStructureImpl[] localTable, int key, int[] probeInfo, int probeAddr) (package private) 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.private void
private void
private static boolean
private static boolean
private JCasHashMapSubMap
newTable
(int capacity) private FeatureStructureImpl[]
newTableKeepSize
(int capacity) (package private) FeatureStructureImpl
put
(int key, FeatureStructureImpl value, int hash) private void
putInner
(int key, FeatureStructureImpl value, int hash) Only used to fill in newly expanded table always called with lock heldprivate static void
resetProbeInfo
(int[] probeInfo) private static void
setProbeInfo
(int[] probeInfo, int probeAddr, int probeDelta) private void
updateHistogram
(int nbrProbes, boolean isContinue)
-
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
-
probeInfoGet
-
probeInfoPut
-
probeInfoPutInner
-
histogram
int[] histogram -
maxProbe
int maxProbe -
maxProbeAfterContinue
int maxProbeAfterContinue -
continues
int continues -
lock
-
lockCondition
-
sizeWhichTriggersExpansion
private int sizeWhichTriggersExpansion -
size
int size -
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
-
newTableKeepSize
-
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
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 heaphash
- - the hash that was already computed from the key- Returns:
- - the found fs, or null
-
put
-
putInner
Only used to fill in newly expanded table always called with lock held- Parameters:
key
- -value
- -hash
- -
-
increaseTableCapacity
private void increaseTableCapacity() -
isReserve
-
isReal
-
resetProbeInfo
private static void resetProbeInfo(int[] probeInfo) -
setProbeInfo
private static void setProbeInfo(int[] probeInfo, int probeAddr, int probeDelta)
-