src/share/classes/java/nio/channels/Selector.java

Print this page

        

*** 304,313 **** --- 304,322 ---- * operation</a>. It returns only after at least one channel is selected, * this selector's {@link #wakeup wakeup} method is invoked, the current * thread is interrupted, or the given timeout period expires, whichever * comes first. * + * <p> + * Note an application should not check <tt>OP_CONNECT</tt> again, once a + * channel is already connected. In this situation, Selector will always + * treat <tt> OP_CONNECT</tt> as ready. If do so with only one key in this + * selector, and only one <tt>OP_CONNECT</tt> operation in the key's + * interest set, this method will return immediately with no entries in the + * selected key set. + * </p> + * * <p> This method does not offer real-time guarantees: It schedules the * timeout as if by invoking the {@link Object#wait(long)} method. </p> * * @param timeout If positive, block for up to <tt>timeout</tt> * milliseconds, more or less, while waiting for a
*** 336,345 **** --- 345,371 ---- * <p> This method performs a blocking <a href="#selop">selection * operation</a>. It returns only after at least one channel is selected, * this selector's {@link #wakeup wakeup} method is invoked, or the current * thread is interrupted, whichever comes first. </p> * + * <p> + * Note an application should not check <tt>OP_CONNECT</tt> again, once a + * channel is already connected. In this situation, Selector will always + * treat <tt> OP_CONNECT</tt> as ready. If do so with only one key in this + * selector, and only one <tt>OP_CONNECT</tt> operation in the key's + * interest set, this method will return immediately with no entries in the + * selected key set. + * </p> + * + * <p> + * Note that for <tt>OP_CONNECT</tt>, once a channel is already connected, + * an application should not check <tt>OP_CONNECT</tt> again. In this + * situation, Selector will ignore <tt>OP_CONNECT</tt>. If there is only one + * key in this selector, and only one <tt>OP_CONNECT</tt> operation in the key's + * interest set, this method will return immediately. + * </p> + * * @return The number of keys, possibly zero, * whose ready-operation sets were updated * * @throws IOException * If an I/O error occurs
*** 364,373 **** --- 390,408 ---- * again in the meantime. * * <p> Invoking this method more than once between two successive selection * operations has the same effect as invoking it just once. </p> * + * <p> + * Note an application should not check <tt>OP_CONNECT</tt> again, once a + * channel is already connected. In this situation, Selector will always + * treat <tt> OP_CONNECT</tt> as ready. If do so with only one key in this + * selector, and only one <tt>OP_CONNECT</tt> operation in the key's + * interest set, this method will return immediately with no entries in the + * selected key set. + * </p> + * * @return This selector */ public abstract Selector wakeup(); /**