Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


InterruptibleChanneljava.nio.channels

Java 1.4closeable

Channels that implement this marker interface
have two important properties that are relevant to multithreaded
programs: they are

asynchonously closeable and

interruptible . When the close(
) method of an InterruptibleChannel is
called, any other thread that is blocked waiting for an I/O operation
to complete on that channel will stop blocking and receive an
AsynchronousCloseException. Furthermore, if a
thread is blocked waiting for an I/O operation to complete on an
InterruptibleChannel, then another thread may call
the interrupt( ) method of the blocked thread.
This causes the interrupt status of the blocked thread to be set and
causes the thread to wake up and receive an
ClosedByInterruptException (a subclass of
AsynchronousCloseException). As the name of this
interrupt implies, the channel that the thread was blocked on is
closed as a side-effect of the thread interruption. There is no way
to interrupt a blocked thread without closing the channel upon which
it is blocked. This ability to interrupt a blocked thread is
particularly noteworthy because it has never worked reliably with the
older java.io API.

All the concrete channel implementations that are part of this
package implement InterruptibleChannel. Note,
however, that methods such as Channels.newChannel(
) may return channel objects that are not interruptible.
You can use the instanceof to determine whether an
unknown channel object implements this interface.


Figure 13-28. java.nio.channels.InterruptibleChannel

public interface

InterruptibleChannel extends Channel {
// Public Instance Methods
void

close ( ) throws java.io.IOException;
}


Implementations


java.nio.channels.spi.AbstractInterruptibleChannel


    / 1191