Do these methods have same output?
Posted
by devrimbaris
on Stack Overflow
See other posts from Stack Overflow
or by devrimbaris
Published on 2010-06-17T12:21:04Z
Indexed on
2010/06/17
12:23 UTC
Read the original article
Hit count: 100
java
|concurrency
protected synchronized boolean isTimeoutOccured(Duration timeoutDuration) { DateTime now = new DateTime();
if (timeoutOccured == false) {
if (new Duration(requestTime.getMillis(), now.getMillis()).compareTo(timeoutDuration) > 0) {
timeoutOccured = true;
}
}
return timeoutOccured;
}
protected boolean isTimeoutOccured2(Duration timeoutDuration) {
return atomicTimeOut.compareAndSet(false, new Duration(requestTime.getMillis(), new DateTime().getMillis()).compareTo(timeoutDuration) > 0);
}
© Stack Overflow or respective owner