gpt4 book ai didi

java - 这些方法是否具有相同的输出?

转载 作者:行者123 更新时间:2023-12-04 06:51:28 24 4
gpt4 key购买 nike

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);

}

最佳答案

是的,但原子原语更有效。

关于java - 这些方法是否具有相同的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3061536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com