- java.lang.Object
-
- org.xnio.Connection
-
- org.xnio.StreamConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.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 java.nio.channels.Channel>
-
-
Field Summary
-
Fields inherited from class org.xnio.Connection
thread
-
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStreamConnection(XnioIoThread thread)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelListener<? super StreamConnection>getCloseListener()Get the close listener.ChannelListener.Setter<? extends StreamConnection>getCloseSetter()Get the setter which can be used to change the close listener for this channel.ConduitStreamSinkChannelgetSinkChannel()Get the sink channel.ConduitStreamSourceChannelgetSourceChannel()Get the source channel.protected voidnotifyReadClosed()Indicate to conduit handlers that reads have been closed.protected voidnotifyWriteClosed()Indicate 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, writeClosed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.xnio.channels.BoundChannel
getLocalAddress
-
Methods inherited from interface org.xnio.channels.ConnectedChannel
getPeerAddress
-
-
-
-
Constructor Detail
-
StreamConnection
protected StreamConnection(XnioIoThread thread)
Construct a new instance.- Parameters:
thread- the I/O thread
-
-
Method Detail
-
setCloseListener
public void setCloseListener(ChannelListener<? super StreamConnection> listener)
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
public ChannelListener<? super StreamConnection> getCloseListener()
Description copied from interface:CloseListenerSettableGet the close listener.- Specified by:
getCloseListenerin interfaceCloseListenerSettable<StreamConnection>- Returns:
- the close listener
-
getCloseSetter
public ChannelListener.Setter<? extends StreamConnection> 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
protected void setSourceConduit(StreamSourceConduit conduit)
Set the source conduit for this channel. The source channel will automatically be updated.- Parameters:
conduit- the source conduit for this channel
-
setSinkConduit
protected void setSinkConduit(StreamSinkConduit conduit)
Set the sink conduit for this channel. The sink channel will automatically be updated.- Parameters:
conduit- the sink conduit for this channel
-
getSourceChannel
public ConduitStreamSourceChannel getSourceChannel()
Get the source channel.- Returns:
- the source channel
-
getSinkChannel
public ConduitStreamSinkChannel getSinkChannel()
Get the sink channel.- Returns:
- the sink channel
-
-