0N/A/*
2362N/A * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A */
0N/A
0N/Apackage java.nio.channels;
0N/A
0N/Aimport java.io.IOException;
0N/A
0N/A
0N/A/**
0N/A * A channel that can be asynchronously closed and interrupted.
0N/A *
0N/A * <p> A channel that implements this interface is <i>asynchronously
0N/A * closeable:</i> If a thread is blocked in an I/O operation on an
0N/A * interruptible channel then another thread may invoke the channel's {@link
0N/A * #close close} method. This will cause the blocked thread to receive an
0N/A * {@link AsynchronousCloseException}.
0N/A *
0N/A * <p> A channel that implements this interface is also <i>interruptible:</i>
0N/A * If a thread is blocked in an I/O operation on an interruptible channel then
0N/A * another thread may invoke the blocked thread's {@link Thread#interrupt()
0N/A * interrupt} method. This will cause the channel to be closed, the blocked
0N/A * thread to receive a {@link ClosedByInterruptException}, and the blocked
0N/A * thread's interrupt status to be set.
0N/A *
0N/A * <p> If a thread's interrupt status is already set and it invokes a blocking
0N/A * I/O operation upon a channel then the channel will be closed and the thread
0N/A * will immediately receive a {@link ClosedByInterruptException}; its interrupt
0N/A * status will remain set.
0N/A *
0N/A * <p> A channel supports asynchronous closing and interruption if, and only
0N/A * if, it implements this interface. This can be tested at runtime, if
0N/A * necessary, via the <tt>instanceof</tt> operator.
0N/A *
0N/A *
0N/A * @author Mark Reinhold
0N/A * @author JSR-51 Expert Group
0N/A * @since 1.4
0N/A */
0N/A
0N/Apublic interface InterruptibleChannel
0N/A extends Channel
0N/A{
0N/A
0N/A /**
0N/A * Closes this channel.
0N/A *
0N/A * <p> Any thread currently blocked in an I/O operation upon this channel
0N/A * will receive an {@link AsynchronousCloseException}.
0N/A *
0N/A * <p> This method otherwise behaves exactly as specified by the {@link
0N/A * Channel#close Channel} interface. </p>
0N/A *
0N/A * @throws IOException If an I/O error occurs
0N/A */
0N/A public void close() throws IOException;
0N/A
0N/A}