The internal data structure that stores the thread-local variables for Netty and all {@link FastThreadLocal}s. Note that this class is for internal use only and is subject to change at any time. Use {@link FastThreadLocal} unless you know what you are doing.
 public static InternalThreadLocalMap Get()
 {
     InternalThreadLocalMap ret = slowThreadLocalMap;
     if (ret == null)
     {
         ret = new InternalThreadLocalMap();
         slowThreadLocalMap = ret;
     }
     return ret;
 }
Beispiel #2
0
        protected static void RemoveFromVariablesToRemove(InternalThreadLocalMap threadLocalMap,
            FastThreadLocal variable)
        {
            object v = threadLocalMap.GetIndexedVariable(VariablesToRemoveIndex);

            if (v == InternalThreadLocalMap.Unset || v == null)
            {
                return;
            }

            var variablesToRemove = (HashSet<FastThreadLocal>) v;
            variablesToRemove.Remove(variable);
        }
Beispiel #3
0
        protected static void AddToVariablesToRemove(InternalThreadLocalMap threadLocalMap, FastThreadLocal variable)
        {
            object v = threadLocalMap.GetIndexedVariable(VariablesToRemoveIndex);
            HashSet<FastThreadLocal> variablesToRemove;
            if (v == InternalThreadLocalMap.Unset || v == null)
            {
                variablesToRemove = new HashSet<FastThreadLocal>();
                    // Collections.newSetFromMap(new IdentityHashMap<FastThreadLocal<?>, Boolean>());
                threadLocalMap.SetIndexedVariable(VariablesToRemoveIndex, variablesToRemove);
            }
            else
            {
                variablesToRemove = (HashSet<FastThreadLocal>) v;
            }

            variablesToRemove.Add(variable);
        }
Beispiel #4
0
 /// <summary>
 ///     Sets the value to uninitialized; a proceeding call to get() will trigger a call to GetInitialValue().
 /// </summary>
 /// <param name="threadLocalMap"></param>
 public abstract void Remove(InternalThreadLocalMap threadLocalMap);
 public static void Destroy() => slowThreadLocalMap = null;
 public static void Remove() => slowThreadLocalMap = null;
 public static void Destroy() => slowThreadLocalMap = null;
 public static void Remove() => slowThreadLocalMap = null;
Beispiel #9
0
 /// <summary>
 ///     Sets the value to uninitialized; a proceeding call to get() will trigger a call to GetInitialValue().
 /// </summary>
 /// <param name="threadLocalMap"></param>
 public abstract void Remove(InternalThreadLocalMap threadLocalMap);
Beispiel #10
0
 /// Destroys the data structure that keeps all {@link FastThreadLocal} variables accessed from
 /// non-{@link FastThreadLocalThread}s.  This operation is useful when you are in a container environment, and you
 /// do not want to leave the thread local variables in the threads you do not manage.  Call this method when your
 /// application is being unloaded from the container.
 public static void Destroy() => InternalThreadLocalMap.Destroy();