This commit is contained in:
Clebert Suconic 2017-09-07 10:40:14 -04:00
commit 7f9545f4f2
3 changed files with 3 additions and 3 deletions

View File

@ -330,7 +330,7 @@ public class NettyConnection implements Connection {
parkNanos = 1000L;
}
boolean canWrite;
while (!(canWrite = canWrite(requiredCapacity)) && System.nanoTime() < deadline) {
while (!(canWrite = canWrite(requiredCapacity)) && (System.nanoTime() - deadline) < 0) {
//periodically check the connection state
checkConnectionState();
LockSupport.parkNanos(parkNanos);

View File

@ -386,7 +386,7 @@ public final class TimedBuffer {
lastFlushTime = System.nanoTime();
flush();
} else if (bufferObserver != null && System.nanoTime() > lastFlushTime + timeout) {
} else if (bufferObserver != null && System.nanoTime() - lastFlushTime > timeout) {
lastFlushTime = System.nanoTime();
// if not using flush we will spin and do the time checks manually
flush();

View File

@ -227,7 +227,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
private static void spinSleep(long timeout) {
if (timeout > 0) {
final long deadline = System.nanoTime() + timeout;
while (System.nanoTime() < deadline) {
while (System.nanoTime() - deadline < 0) {
//spin wait
}
}