< prev index next >

src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java

Print this page

        

@@ -40,11 +40,11 @@
 
 /**
  * Selector implementation based on poll
  */
 
-class PollSelectorImpl extends SelectorImpl {
+public class PollSelectorImpl extends SelectorImpl {
 
     // initial capacity of poll array
     private static final int INITIAL_CAPACITY = 16;
 
     // poll array, grows as needed

@@ -65,11 +65,11 @@
 
     // interrupt triggering and clearing
     private final Object interruptLock = new Object();
     private boolean interruptTriggered;
 
-    PollSelectorImpl(SelectorProvider sp) throws IOException {
+    protected PollSelectorImpl(SelectorProvider sp) throws IOException {
         super(sp);
 
         int size = pollArrayCapacity * SIZE_POLLFD;
         this.pollArray = new AllocatedNativeObject(size, false);
 

@@ -131,10 +131,18 @@
         processDeregisterQueue();
         return processEvents(action);
     }
 
     /**
+     * Protected poll method allows different platform-specific
+     * native implementations
+     */
+    protected int poll(long pollAddress, int numfds, int timeout) {
+        return poll0(pollAddress, numfds, timeout);
+    }
+
+    /**
      * Process changes to the interest ops.
      */
     private void processUpdateQueue() {
         assert Thread.holdsLock(this);
 

@@ -375,11 +383,11 @@
     private int getReventOps(int i) {
         int offset = SIZE_POLLFD * i + REVENT_OFFSET;
         return pollArray.getShort(offset);
     }
 
-    private static native int poll(long pollAddress, int numfds, int timeout);
+    private static native int poll0(long pollAddress, int numfds, int timeout);
 
     static {
         IOUtil.load();
     }
 }
< prev index next >