I've been staring at SharedValue for the last 15 minutes and I can't figure out how it works.
Naively, I don't see how it's possible to safely implement trySetValue(newValue). Wouldn't it have to be compareAndSetValue(oldValue, newValue)? I'm imagining client code that looks like this: byte[] currentValue = sharedValue.getValue(); byte[] newValue = operationOn(currentValue); sharedValue.compareAndSetValue(currentValue, newValue); The only way to write this right now (unless I'm missing something) is: byte[] currentValue = sharedValue.getValue(); byte[] newValue = operationOn(currentValue); sharedValue.trySetValue(newValue); The problem is, an update can happen in between the call to getValue() and trySetValue(), and the way the code's written, SharedValue doesn't record read accesses, so it has no idea if any user code actually called getValue() "recently". Am I missing something? Scott
