|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
public abstract class AbstractInterruptibleChannel
This class roots the implementation of interruptible channels.
The basic usage pattern for an interruptible channel is to invoke
begin() before any IO operations, then
end(boolean) after completing the operation. The argument to
the end method shows whether there has been any change to the java
environment that is visible to the API user.
| Field Summary | |
|---|---|
(package private) boolean |
interrupted
|
(package private) static Method |
setInterruptAction
|
| Constructor Summary | |
|---|---|
protected |
AbstractInterruptibleChannel()
Default constructor. |
| Method Summary | |
|---|---|
protected void |
begin()
Start an IO operation that is potentially blocking. |
void |
close()
Closes the channel. |
protected void |
end(boolean success)
End an IO operation that was previously started with begin(). |
protected abstract void |
implCloseChannel()
Implements the close channel behavior. |
boolean |
isOpen()
Returns whether the channel is open. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static Method setInterruptAction
volatile boolean interrupted
| Constructor Detail |
|---|
protected AbstractInterruptibleChannel()
| Method Detail |
|---|
public final boolean isOpen()
isOpen in interface ChannelChannel.isOpen()
public final void close()
throws IOException
If the channel is already closed then this method has no effect, otherwise it closes the receiver via the implCloseChannel method.
close in interface Closeableclose in interface Channelclose in interface InterruptibleChannelIOException - if a problem occurs closing the channel.Channel.close()protected final void begin()
Once the operation is completed the application should invoke a
corresponding end(boolean).
protected final void end(boolean success)
throws AsynchronousCloseException
begin().
success - pass true if the operation succeeded and had a side effect on
the Java system, or false if not.
AsynchronousCloseException - the channel was closed while the IO operation was in
progress.
ClosedByInterruptException - the thread conducting the IO operation was interrupted.
protected abstract void implCloseChannel()
throws IOException
Closes the channel with a guarantee that the channel is not currently
closed via close() and that the method is thread-safe.
any outstanding threads blocked on IO operations on this channel must be
released with either a normal return code, or an
AsynchronousCloseException.
IOException - if a problem occurs closing the channel.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||