return (T) v.get(); LazyInitializer<T> l = new LazyInitializer<T>(this); LazyInitializer<?> existing = variableMap.putIfAbsent(this, l); if (existing == null) { return l.get(); } else { return (T) existing.get();
return (T) v.get(); LazyInitializer<T> l = new LazyInitializer<T>(this); LazyInitializer<?> existing = variableMap.putIfAbsent(this, l); if (existing == null) { return l.get(); } else { return (T) existing.get();
/** * Sets the value of the HystrixRequestVariable for the current request context. * <p> * Note, if a value already exists, the set will result in overwriting that value. It is up to the caller to ensure the existing value is cleaned up. The {@link #shutdown} method will not be * called * * @param value * the value to set */ public void set(T value) { HystrixRequestContext.getContextForCurrentThread().state.put(this, new LazyInitializer<T>(this, value)); }
@SuppressWarnings("unchecked") /* package */static <T> void remove(HystrixRequestContext context, HystrixRequestVariableDefault<T> v) { // remove first so no other threads get it LazyInitializer<?> o = context.state.remove(v); if (o != null) { // this thread removed it so let's execute shutdown v.shutdown((T) o.get()); } }
@SuppressWarnings("unchecked") /* package */static <T> void remove(HystrixRequestContext context, HystrixRequestVariableDefault<T> v) { // remove first so no other threads get it LazyInitializer<?> o = context.state.remove(v); if (o != null) { // this thread removed it so let's execute shutdown v.shutdown((T) o.get()); } }
/** * Sets the value of the HystrixRequestVariable for the current request context. * <p> * Note, if a value already exists, the set will result in overwriting that value. It is up to the caller to ensure the existing value is cleaned up. The {@link #shutdown} method will not be * called * * @param value * the value to set */ public void set(T value) { HystrixRequestContext.getContextForCurrentThread().state.put(this, new LazyInitializer<T>(this, value)); }