GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: Extract a selectReturnPrematurely method · netty/netty@ebf2255

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • transport/src/main/java/io/netty/channel/nio
    • NioEventLoop.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎transport/src/main/java/io/netty/channel/nio/NioEventLoop.java‎

Copy file name to clipboardExpand all lines: transport/src/main/java/io/netty/channel/nio/NioEventLoop.java
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,7 @@ protected void run() {
569569
ranTasks = runAllTasks(0); // This will run the minimum number of tasks
570570
}
571571

572-
if (ranTasks || strategy > 0) {
573-
if (selectCnt > MIN_PREMATURE_SELECTOR_RETURNS && logger.isDebugEnabled()) {
574-
logger.debug("Selector.select() returned prematurely {} times in a row for Selector {}.",
575-
selectCnt - 1, selector);
576-
}
572+
if (selectReturnPrematurely(selectCnt, ranTasks, strategy)) {
577573
selectCnt = 0;
578574
} else if (unexpectedSelectorWakeup(selectCnt)) { // Unexpected wakeup (unusual case)
579575
selectCnt = 0;
@@ -606,6 +602,18 @@ protected void run() {
606602
}
607603
}
608604

605+
// returns true if selectCnt should be reset
606+
private boolean selectReturnPrematurely(int selectCnt, boolean ranTasks, int strategy) {
607+
if (ranTasks || strategy > 0) {
608+
if (selectCnt > MIN_PREMATURE_SELECTOR_RETURNS && logger.isDebugEnabled()) {
609+
logger.debug("Selector.select() returned prematurely {} times in a row for Selector {}.",
610+
selectCnt - 1, selector);
611+
}
612+
return true;
613+
}
614+
return false;
615+
}
616+
609617
// returns true if selectCnt should be reset
610618
private boolean unexpectedSelectorWakeup(int selectCnt) {
611619
if (Thread.interrupted()) {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.