--- old/src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java 2015-07-18 15:41:50.586001007 +0100 +++ new/src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java 2015-07-18 15:41:50.458000853 +0100 @@ -28,8 +28,7 @@ import java.io.IOException; import java.nio.channels.*; import java.nio.channels.spi.*; -import java.util.*; -import sun.misc.*; +import java.util.function.Consumer; /** @@ -62,9 +61,47 @@ channelArray = new SelectionKeyImpl[INIT_CAP]; } - protected int doSelect(long timeout) - throws IOException - { + @Override + protected int doSelect(long timeout) throws IOException { + pollWrapper(timeout); + int numKeysUpdated = updateSelectedKeys(); + clearWakeupPipeIfInterrupted(); + return numKeysUpdated; + } + + @Override + protected int doSelect(Consumer handler, long timeout) throws IOException { + pollWrapper(timeout); + int numKeysUpdated = 0; + // Skip zeroth entry; it is for interrupts only + for (int i=channelOffset; i