public boolean isSet() { return localeValue.exists(); } }
@Override public synchronized Status getStatus() { if (perThreadStatus != null) { if (!perThreadStatus.exists()) perThreadStatus.set(status); return perThreadStatus.get(); } else return status; }
@Override public synchronized Status getStatus() { if (perThreadStatus != null) { if (!perThreadStatus.exists()) perThreadStatus.set(status); return perThreadStatus.get(); } else return status; }
public Object get(Object instance, InstanceContext context) { if (!fieldValue.exists()) { Object persistedValue = resources.hasFieldChange(name) ? resources.getFieldChange(name) : defaultValue; fieldValue.set(persistedValue); } return fieldValue.get(); }
private MethodResultCache getOrCreateCache(MethodInvocation invocation) { Object instance = invocation.getInstance(); // The PerThreadValue is created in the instance constructor. PerThreadValue<MethodResultCache> value = (PerThreadValue<MethodResultCache>) fieldHandle .get(instance); // But it will be empty when first created, or at the start of a new request. if (value.exists()) { return value.get(); } // Use the factory to create a MethodResultCache for the combination of instance, method, and thread. return value.set(factory.create(instance)); } };