public static InternalThreadLocalMap Get() { InternalThreadLocalMap ret = slowThreadLocalMap; if (ret == null) { ret = new InternalThreadLocalMap(); slowThreadLocalMap = ret; } return ret; }
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); }
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); }
/// <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;
/// <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);
/// 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();