Switch to System.nanoTime() to calculate block time of Selector.select(..)
This commit is contained in:
parent
ff3f2b6361
commit
798390fc4d
@ -253,10 +253,10 @@ abstract class AbstractNioWorker implements Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long beforeSelect = System.currentTimeMillis();
|
long beforeSelect = System.nanoTime();
|
||||||
int selected = SelectorUtil.select(selector);
|
int selected = SelectorUtil.select(selector);
|
||||||
if (selected == 0) {
|
if (selected == 0) {
|
||||||
long timeBlocked = System.currentTimeMillis() - beforeSelect;
|
long timeBlocked = System.nanoTime() - beforeSelect;
|
||||||
if (timeBlocked < SelectorUtil.SELECT_WAIT_TIME) {
|
if (timeBlocked < SelectorUtil.SELECT_WAIT_TIME) {
|
||||||
// returned before the SELECT_WAIT_TIME elapsed with nothing select.
|
// returned before the SELECT_WAIT_TIME elapsed with nothing select.
|
||||||
// this may be the cause of the jdk epoll(..) bug, so increment the counter
|
// this may be the cause of the jdk epoll(..) bug, so increment the counter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user