Package org.xnio.channels
Interface CloseableChannel
- All Superinterfaces:
AutoCloseable,Channel,Closeable,Configurable,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
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
Modifier and TypeMethodDescriptionvoidclose()Close this channel.ChannelListener.Setter<? extends CloseableChannel>Get the setter which can be used to change the close listener for this channel.Get the I/O thread associated with this channel.Get the worker for this channel.Methods inherited from interface org.xnio.channels.Configurable
getOption, setOption, supportsOption
-
Method Details
-
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
Close 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 interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceInterruptibleChannel- Throws:
IOException- if the close failed
-