equal
deleted
inserted
replaced
41 * the interruption of selection operations. A concrete selector class must |
41 * the interruption of selection operations. A concrete selector class must |
42 * invoke the {@link #begin begin} and {@link #end end} methods before and |
42 * invoke the {@link #begin begin} and {@link #end end} methods before and |
43 * after, respectively, invoking an I/O operation that might block |
43 * after, respectively, invoking an I/O operation that might block |
44 * indefinitely. In order to ensure that the {@link #end end} method is always |
44 * indefinitely. In order to ensure that the {@link #end end} method is always |
45 * invoked, these methods should be used within a |
45 * invoked, these methods should be used within a |
46 * <tt>try</tt> ... <tt>finally</tt> block: |
46 * {@code try} ... {@code finally} block: |
47 * |
47 * |
48 * <blockquote><pre> |
48 * <blockquote><pre> |
49 * try { |
49 * try { |
50 * begin(); |
50 * begin(); |
51 * // Perform blocking I/O operation here |
51 * // Perform blocking I/O operation here |
195 |
195 |
196 /** |
196 /** |
197 * Marks the beginning of an I/O operation that might block indefinitely. |
197 * Marks the beginning of an I/O operation that might block indefinitely. |
198 * |
198 * |
199 * <p> This method should be invoked in tandem with the {@link #end end} |
199 * <p> This method should be invoked in tandem with the {@link #end end} |
200 * method, using a <tt>try</tt> ... <tt>finally</tt> block as |
200 * method, using a {@code try} ... {@code finally} block as |
201 * shown <a href="#be">above</a>, in order to implement interruption for |
201 * shown <a href="#be">above</a>, in order to implement interruption for |
202 * this selector. |
202 * this selector. |
203 * |
203 * |
204 * <p> Invoking this method arranges for the selector's {@link |
204 * <p> Invoking this method arranges for the selector's {@link |
205 * Selector#wakeup wakeup} method to be invoked if a thread's {@link |
205 * Selector#wakeup wakeup} method to be invoked if a thread's {@link |
221 |
221 |
222 /** |
222 /** |
223 * Marks the end of an I/O operation that might block indefinitely. |
223 * Marks the end of an I/O operation that might block indefinitely. |
224 * |
224 * |
225 * <p> This method should be invoked in tandem with the {@link #begin begin} |
225 * <p> This method should be invoked in tandem with the {@link #begin begin} |
226 * method, using a <tt>try</tt> ... <tt>finally</tt> block as |
226 * method, using a {@code try} ... {@code finally} block as |
227 * shown <a href="#be">above</a>, in order to implement interruption for |
227 * shown <a href="#be">above</a>, in order to implement interruption for |
228 * this selector. </p> |
228 * this selector. </p> |
229 */ |
229 */ |
230 protected final void end() { |
230 protected final void end() { |
231 AbstractInterruptibleChannel.blockedOn(null); |
231 AbstractInterruptibleChannel.blockedOn(null); |