Only call System.nanoTime() if no read batch is ongoing. Related to [#3808]
Motivation: [#3808] introduced some improvements to reduce the calls to System.nanoTime() but missed one possible optimization. Modifications: Only call System.nanoTime() if no reading patch is in process. Result: Less System.nanoTime() calls.
This commit is contained in:
parent
4877fffa0a
commit
9d675def81
@ -212,10 +212,9 @@ public class ReadTimeoutHandler extends ChannelInboundHandlerAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long currentTime = System.nanoTime();
|
|
||||||
long nextDelay = timeoutNanos;
|
long nextDelay = timeoutNanos;
|
||||||
if (!reading) {
|
if (!reading) {
|
||||||
nextDelay -= currentTime - lastReadTime;
|
nextDelay -= System.nanoTime() - lastReadTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextDelay <= 0) {
|
if (nextDelay <= 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user