Ted Yu
2014-02-25 04:00:29 UTC
Hi,
Given the following code (in multi-threaded environment):
else if (maximumTimestamp < timestamp) {
maximumTimestamp = timestamp;
}
AtomicLong#compareAndSet can only update value based on equality.
Is there some way where the max can be set without adding synchronized keyword to the method ?
Thanks
Given the following code (in multi-threaded environment):
else if (maximumTimestamp < timestamp) {
maximumTimestamp = timestamp;
}
AtomicLong#compareAndSet can only update value based on equality.
Is there some way where the max can be set without adding synchronized keyword to the method ?
Thanks