Package org.xnio
Class StreamConnection
java.lang.Object
org.xnio.Connection
org.xnio.StreamConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,BoundChannel,CloseableChannel,CloseListenerSettable<StreamConnection>,Configurable,ConnectedChannel
- Direct Known Subclasses:
SslConnection
public abstract class StreamConnection
extends Connection
implements CloseListenerSettable<StreamConnection>
A connection between peers.
- Author:
- David M. Lloyd, Flavia Rainone
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.xnio.channels.CloseListenerSettable
CloseListenerSettable.Setter<C extends Channel> -
Field Summary
Fields inherited from class org.xnio.Connection
threadFields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStreamConnection(XnioIoThread thread) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionChannelListener<? super StreamConnection>Get the close listener.ChannelListener.Setter<? extends StreamConnection>Get the setter which can be used to change the close listener for this channel.Get the sink channel.Get the source channel.protected voidIndicate to conduit handlers that reads have been closed.protected voidIndicate to conduit handlers that writes have been closed.voidsetCloseListener(ChannelListener<? super StreamConnection> listener) Set the close listener.protected voidsetSinkConduit(StreamSinkConduit conduit) Set the sink conduit for this channel.protected voidsetSourceConduit(StreamSourceConduit conduit) Set the source conduit for this channel.Methods inherited from class org.xnio.Connection
close, closeAction, getIoThread, getLocalAddress, getOption, getPeerAddress, getWorker, isOpen, isReadShutdown, isWriteShutdown, readClosed, setOption, supportsOption, writeClosedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xnio.channels.BoundChannel
getLocalAddressMethods inherited from interface org.xnio.channels.ConnectedChannel
getPeerAddress
-
Constructor Details
-
StreamConnection
Construct a new instance.- Parameters:
thread- the I/O thread
-
-
Method Details
-
setCloseListener
Description copied from interface:CloseListenerSettableSet the close listener.- Specified by:
setCloseListenerin interfaceCloseListenerSettable<StreamConnection>- Parameters:
listener- the close listener
-
notifyReadClosed
protected void notifyReadClosed()Description copied from class:ConnectionIndicate to conduit handlers that reads have been closed.- Specified by:
notifyReadClosedin classConnection
-
notifyWriteClosed
protected void notifyWriteClosed()Description copied from class:ConnectionIndicate to conduit handlers that writes have been closed.- Specified by:
notifyWriteClosedin classConnection
-
getCloseListener
Description copied from interface:CloseListenerSettableGet the close listener.- Specified by:
getCloseListenerin interfaceCloseListenerSettable<StreamConnection>- Returns:
- the close listener
-
getCloseSetter
Description copied from interface:CloseableChannelGet 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.- Specified by:
getCloseSetterin interfaceBoundChannel- Specified by:
getCloseSetterin interfaceCloseableChannel- Specified by:
getCloseSetterin interfaceConnectedChannel- Returns:
- the setter
-
setSourceConduit
Set the source conduit for this channel. The source channel will automatically be updated.- Parameters:
conduit- the source conduit for this channel
-
setSinkConduit
Set the sink conduit for this channel. The sink channel will automatically be updated.- Parameters:
conduit- the sink conduit for this channel
-
getSourceChannel
Get the source channel.- Returns:
- the source channel
-
getSinkChannel
Get the sink channel.- Returns:
- the sink channel
-