internal static void Remove(HystrixRequestContext context, IHystrixRequestVariable <T> v) { if (context.State.TryRemove(v, out object oldValue)) { v.Dispose(); } }
public object Get(IHystrixConcurrencyStrategy concurrencyStrategy) { HystrixRequestVariableCacheKey key = new HystrixRequestVariableCacheKey(this, concurrencyStrategy); IHystrixRequestVariable rvInstance = requestVariableInstance.GetOrAdd(key, w => { if (requestVariableInstance.Count > 100) { logger.Warn("Over 100 instances of HystrixRequestVariable are being stored. This is likely the sign of a memory leak caused by using unique instances of HystrixConcurrencyStrategy instead of a single instance."); } return(concurrencyStrategy.GetRequestVariable(lifeCycleMethods)); }); return(rvInstance.Value); }