Package io.netty.util.internal
Class InternalThreadLocalMap
- java.lang.Object
-
- io.netty.util.internal.UnpaddedInternalThreadLocalMap
-
- io.netty.util.internal.InternalThreadLocalMap
-
public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
The internal data structure that stores the thread-local variables for Netty and allFastThreadLocals. Note that this class is for internal use only and is subject to change at any time. UseFastThreadLocalunless you know what you are doing.
-
-
Field Summary
Fields Modifier and Type Field Description private static intARRAY_LIST_CAPACITY_EXPAND_THRESHOLDprivate static intARRAY_LIST_CAPACITY_MAX_SIZEprivate java.util.ArrayList<java.lang.Object>arrayListprivate java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetDecoder>charsetDecoderCacheprivate java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetEncoder>charsetEncoderCacheprivate java.util.BitSetcleanerFlagsprivate IntegerHoldercounterHashCodeprivate static intDEFAULT_ARRAY_LIST_INITIAL_CAPACITYprivate intfutureListenerStackDepthprivate static intHANDLER_SHARABLE_CACHE_INITIAL_CAPACITYprivate java.util.Map<java.lang.Class<?>,java.lang.Boolean>handlerSharableCacheprivate static intINDEXED_VARIABLE_TABLE_INITIAL_SIZEprivate java.lang.Object[]indexedVariablesUsed byFastThreadLocalprivate intlocalChannelReaderStackDepthprivate static InternalLoggerloggerprivate static java.util.concurrent.atomic.AtomicIntegernextIndexprivate ThreadLocalRandomrandomlongrp1Deprecated.These padding fields will be removed in the future.longrp2Deprecated.These padding fields will be removed in the future.longrp3Deprecated.These padding fields will be removed in the future.longrp4Deprecated.These padding fields will be removed in the future.longrp5Deprecated.These padding fields will be removed in the future.longrp6Deprecated.These padding fields will be removed in the future.longrp7Deprecated.These padding fields will be removed in the future.longrp8Deprecated.These padding fields will be removed in the future.private static java.lang.ThreadLocal<InternalThreadLocalMap>slowThreadLocalMapprivate static intSTRING_BUILDER_INITIAL_SIZEprivate static intSTRING_BUILDER_MAX_SIZEprivate java.lang.StringBuilderstringBuilderprivate java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,TypeParameterMatcher>>typeParameterMatcherFindCacheprivate java.util.Map<java.lang.Class<?>,TypeParameterMatcher>typeParameterMatcherGetCachestatic java.lang.ObjectUNSETInternal use only.static intVARIABLES_TO_REMOVE_INDEX
-
Constructor Summary
Constructors Modifier Constructor Description privateInternalThreadLocalMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <E> java.util.ArrayList<E>arrayList()<E> java.util.ArrayList<E>arrayList(int minCapacity)java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetDecoder>charsetDecoderCache()java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetEncoder>charsetEncoderCache()IntegerHoldercounterHashCode()Deprecated.static voiddestroy()private voidexpandIndexedVariableTableAndSet(int index, java.lang.Object value)private static InternalThreadLocalMapfastGet(FastThreadLocalThread thread)intfutureListenerStackDepth()static InternalThreadLocalMapget()java.lang.ObjectgetAndSetIndexedVariable(int index, java.lang.Object value)static InternalThreadLocalMapgetIfSet()java.util.Map<java.lang.Class<?>,java.lang.Boolean>handlerSharableCache()java.lang.ObjectindexedVariable(int index)booleanisCleanerFlagSet(int index)booleanisIndexedVariableSet(int index)static intlastVariableIndex()intlocalChannelReaderStackDepth()private static java.lang.Object[]newIndexedVariableTable()static intnextVariableIndex()ThreadLocalRandomrandom()static voidremove()java.lang.ObjectremoveIndexedVariable(int index)voidsetCleanerFlag(int index)voidsetCounterHashCode(IntegerHolder counterHashCode)Deprecated.voidsetFutureListenerStackDepth(int futureListenerStackDepth)booleansetIndexedVariable(int index, java.lang.Object value)voidsetLocalChannelReaderStackDepth(int localChannelReaderStackDepth)intsize()private static InternalThreadLocalMapslowGet()java.lang.StringBuilderstringBuilder()java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,TypeParameterMatcher>>typeParameterMatcherFindCache()java.util.Map<java.lang.Class<?>,TypeParameterMatcher>typeParameterMatcherGetCache()
-
-
-
Field Detail
-
slowThreadLocalMap
private static final java.lang.ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap
-
nextIndex
private static final java.util.concurrent.atomic.AtomicInteger nextIndex
-
VARIABLES_TO_REMOVE_INDEX
public static final int VARIABLES_TO_REMOVE_INDEX
-
DEFAULT_ARRAY_LIST_INITIAL_CAPACITY
private static final int DEFAULT_ARRAY_LIST_INITIAL_CAPACITY
- See Also:
- Constant Field Values
-
ARRAY_LIST_CAPACITY_EXPAND_THRESHOLD
private static final int ARRAY_LIST_CAPACITY_EXPAND_THRESHOLD
- See Also:
- Constant Field Values
-
ARRAY_LIST_CAPACITY_MAX_SIZE
private static final int ARRAY_LIST_CAPACITY_MAX_SIZE
- See Also:
- Constant Field Values
-
HANDLER_SHARABLE_CACHE_INITIAL_CAPACITY
private static final int HANDLER_SHARABLE_CACHE_INITIAL_CAPACITY
- See Also:
- Constant Field Values
-
INDEXED_VARIABLE_TABLE_INITIAL_SIZE
private static final int INDEXED_VARIABLE_TABLE_INITIAL_SIZE
- See Also:
- Constant Field Values
-
STRING_BUILDER_INITIAL_SIZE
private static final int STRING_BUILDER_INITIAL_SIZE
-
STRING_BUILDER_MAX_SIZE
private static final int STRING_BUILDER_MAX_SIZE
-
logger
private static final InternalLogger logger
-
UNSET
public static final java.lang.Object UNSET
Internal use only.
-
indexedVariables
private java.lang.Object[] indexedVariables
Used byFastThreadLocal
-
futureListenerStackDepth
private int futureListenerStackDepth
-
localChannelReaderStackDepth
private int localChannelReaderStackDepth
-
handlerSharableCache
private java.util.Map<java.lang.Class<?>,java.lang.Boolean> handlerSharableCache
-
counterHashCode
private IntegerHolder counterHashCode
-
random
private ThreadLocalRandom random
-
typeParameterMatcherGetCache
private java.util.Map<java.lang.Class<?>,TypeParameterMatcher> typeParameterMatcherGetCache
-
typeParameterMatcherFindCache
private java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,TypeParameterMatcher>> typeParameterMatcherFindCache
-
stringBuilder
private java.lang.StringBuilder stringBuilder
-
charsetEncoderCache
private java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetEncoder> charsetEncoderCache
-
charsetDecoderCache
private java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetDecoder> charsetDecoderCache
-
arrayList
private java.util.ArrayList<java.lang.Object> arrayList
-
cleanerFlags
private java.util.BitSet cleanerFlags
-
rp1
public long rp1
Deprecated.These padding fields will be removed in the future.
-
rp2
public long rp2
Deprecated.These padding fields will be removed in the future.
-
rp3
public long rp3
Deprecated.These padding fields will be removed in the future.
-
rp4
public long rp4
Deprecated.These padding fields will be removed in the future.
-
rp5
public long rp5
Deprecated.These padding fields will be removed in the future.
-
rp6
public long rp6
Deprecated.These padding fields will be removed in the future.
-
rp7
public long rp7
Deprecated.These padding fields will be removed in the future.
-
rp8
public long rp8
Deprecated.These padding fields will be removed in the future.
-
-
Method Detail
-
getIfSet
public static InternalThreadLocalMap getIfSet()
-
get
public static InternalThreadLocalMap get()
-
fastGet
private static InternalThreadLocalMap fastGet(FastThreadLocalThread thread)
-
slowGet
private static InternalThreadLocalMap slowGet()
-
remove
public static void remove()
-
destroy
public static void destroy()
-
nextVariableIndex
public static int nextVariableIndex()
-
lastVariableIndex
public static int lastVariableIndex()
-
newIndexedVariableTable
private static java.lang.Object[] newIndexedVariableTable()
-
size
public int size()
-
stringBuilder
public java.lang.StringBuilder stringBuilder()
-
charsetEncoderCache
public java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetEncoder> charsetEncoderCache()
-
charsetDecoderCache
public java.util.Map<java.nio.charset.Charset,java.nio.charset.CharsetDecoder> charsetDecoderCache()
-
arrayList
public <E> java.util.ArrayList<E> arrayList()
-
arrayList
public <E> java.util.ArrayList<E> arrayList(int minCapacity)
-
futureListenerStackDepth
public int futureListenerStackDepth()
-
setFutureListenerStackDepth
public void setFutureListenerStackDepth(int futureListenerStackDepth)
-
random
public ThreadLocalRandom random()
-
typeParameterMatcherGetCache
public java.util.Map<java.lang.Class<?>,TypeParameterMatcher> typeParameterMatcherGetCache()
-
typeParameterMatcherFindCache
public java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,TypeParameterMatcher>> typeParameterMatcherFindCache()
-
counterHashCode
@Deprecated public IntegerHolder counterHashCode()
Deprecated.
-
setCounterHashCode
@Deprecated public void setCounterHashCode(IntegerHolder counterHashCode)
Deprecated.
-
handlerSharableCache
public java.util.Map<java.lang.Class<?>,java.lang.Boolean> handlerSharableCache()
-
localChannelReaderStackDepth
public int localChannelReaderStackDepth()
-
setLocalChannelReaderStackDepth
public void setLocalChannelReaderStackDepth(int localChannelReaderStackDepth)
-
indexedVariable
public java.lang.Object indexedVariable(int index)
-
setIndexedVariable
public boolean setIndexedVariable(int index, java.lang.Object value)- Returns:
trueif and only if a new thread-local variable has been created
-
getAndSetIndexedVariable
public java.lang.Object getAndSetIndexedVariable(int index, java.lang.Object value)- Returns:
UNSETif and only if a new thread-local variable has been created.
-
expandIndexedVariableTableAndSet
private void expandIndexedVariableTableAndSet(int index, java.lang.Object value)
-
removeIndexedVariable
public java.lang.Object removeIndexedVariable(int index)
-
isIndexedVariableSet
public boolean isIndexedVariableSet(int index)
-
isCleanerFlagSet
public boolean isCleanerFlagSet(int index)
-
setCleanerFlag
public void setCleanerFlag(int index)
-
-