This closes #1518
This commit is contained in:
commit
7f9545f4f2
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue