@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }
@Override public Set<SelectionKey> select(final SelectorRunner selectorRunner) throws IOException { final Selector selector = selectorRunner.getSelector(); final boolean hasPostponedTasks = !selectorRunner.getPostponedTasks().isEmpty(); // The selector.select(...) returns the *new* SelectionKey count, // so it may return 0 even in the case, when there are unprocessed, but // ready SelectionKeys in the Selector's selected key set. if (!hasPostponedTasks) { selector.select(selectTimeout); } else { selector.selectNow(); } final Set<SelectionKey> selectedKeys = selector.selectedKeys(); if (IS_WORKAROUND_SELECTOR_SPIN) { selectorRunner.checkSelectorSpin( !selectedKeys.isEmpty() || hasPostponedTasks, SPIN_RATE_THRESHOLD); } return selectedKeys; }