src/java.base/share/classes/sun/nio/ch/Net.java
branchniosocketimpl-branch
changeset 57274 07b6be5d9150
parent 57268 adcdd45830a0
child 57278 bf925a3ee68a
--- a/src/java.base/share/classes/sun/nio/ch/Net.java	Mon Mar 18 19:59:05 2019 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/Net.java	Wed Mar 20 13:54:50 2019 +0000
@@ -535,9 +535,18 @@
                                              int level, int opt, int arg, boolean isIPv6)
         throws IOException;
 
+    /**
+     * Polls a file descriptor for events.
+     * @param timeout the timeout to wait; 0 to not wait, -1 to wait indefinitely
+     * @return the polled events or 0 if no events are polled
+     */
     static native int poll(FileDescriptor fd, int events, long timeout)
         throws IOException;
 
+    /**
+     * Performs a non-blocking poll of a file descriptor.
+     * @return the polled events or 0 if no events are polled
+     */
     static int pollNow(FileDescriptor fd, int events) throws IOException {
         return poll(fd, events, 0);
     }
@@ -548,12 +557,18 @@
      * @apiNote This method is public to allow it be used by code in jdk.sctp.
      *
      * @param timeout the timeout to wait; 0 to not wait, -1 to wait indefinitely
-     * @return 1 if connected, 0 if not connected, or IOS_INTERRUPTED
+     * @return true if connected
      */
-    public static native int pollConnect(FileDescriptor fd, long timeout)
+    public static native boolean pollConnect(FileDescriptor fd, long timeout)
         throws IOException;
 
-    static int pollConnectNow(FileDescriptor fd) throws IOException {
+    /**
+     * Performs a non-blocking poll of a connecting socket to test if the
+     * connection has been established.
+     *
+     * @return true if connected
+     */
+    static boolean pollConnectNow(FileDescriptor fd) throws IOException {
         return pollConnect(fd, 0);
     }