-
- All Superinterfaces:
java.lang.AutoCloseable,java.nio.channels.Channel,java.io.Closeable,Configurable,java.nio.channels.InterruptibleChannel
- All Known Subinterfaces:
AcceptingChannel<C>,BoundChannel,BoundMultipointMessageChannel,ConnectedChannel,ConnectedMessageChannel,ConnectedSslStreamChannel,ConnectedStreamChannel,MessageChannel,MulticastMessageChannel,MultipointMessageChannel,ReadableMessageChannel,ReadableMultipointMessageChannel,SimpleAcceptingChannel<C>,SslChannel,StreamChannel,StreamSinkChannel,StreamSourceChannel,SuspendableAcceptChannel,SuspendableChannel,SuspendableReadChannel,SuspendableWriteChannel,WritableMessageChannel,WritableMultipointMessageChannel
- All Known Implementing Classes:
AssembledChannel,AssembledConnectedChannel,AssembledConnectedMessageChannel,AssembledConnectedSslStreamChannel,AssembledConnectedStreamChannel,AssembledMessageChannel,AssembledSslChannel,AssembledStreamChannel,ConduitReadableMessageChannel,ConduitStreamSinkChannel,ConduitStreamSourceChannel,ConduitWritableMessageChannel,Connection,EmptyStreamSourceChannel,FixedLengthStreamSinkChannel,FixedLengthStreamSourceChannel,FramedMessageChannel,JsseSslConnection,JsseSslStreamConnection,MessageConnection,NullStreamSinkChannel,PushBackStreamChannel,SplitStreamSinkChannel,SplitStreamSourceChannel,SslConnection,StreamConnection,TranslatingSuspendableChannel
public interface CloseableChannel extends java.nio.channels.InterruptibleChannel, Configurable
A channel which is closeable. A listener may be registered which is triggered (only once) on channel close.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close this channel.ChannelListener.Setter<? extends CloseableChannel>getCloseSetter()Get the setter which can be used to change the close listener for this channel.XnioIoThreadgetIoThread()Get the I/O thread associated with this channel.XnioWorkergetWorker()Get the worker for this channel.-
Methods inherited from interface org.xnio.channels.Configurable
getOption, setOption, supportsOption
-
-
-
-
Method Detail
-
getCloseSetter
ChannelListener.Setter<? extends CloseableChannel> getCloseSetter()
Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.- Returns:
- the setter
-
getWorker
XnioWorker getWorker()
Get the worker for this channel.- Returns:
- the worker
-
getIoThread
XnioIoThread getIoThread()
Get the I/O thread associated with this channel.- Returns:
- the I/O thread associated with this channel
-
close
void close() throws java.io.IOExceptionClose this channel. When a channel is closed, its close listener is invoked. Invoking this method more than once has no additional effect.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.nio.channels.InterruptibleChannel- Throws:
java.io.IOException- if the close failed
-
-