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
thread
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StreamConnection
(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 void
Indicate to conduit handlers that reads have been closed.protected void
Indicate to conduit handlers that writes have been closed.void
setCloseListener
(ChannelListener<? super StreamConnection> listener) Set the close listener.protected void
setSinkConduit
(StreamSinkConduit conduit) Set the sink conduit for this channel.protected void
setSourceConduit
(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 Details
-
StreamConnection
Construct a new instance.- Parameters:
thread
- the I/O thread
-
-
Method Details
-
setCloseListener
Description copied from interface:CloseListenerSettable
Set the close listener.- Specified by:
setCloseListener
in interfaceCloseListenerSettable<StreamConnection>
- Parameters:
listener
- the close listener
-
notifyReadClosed
protected void notifyReadClosed()Description copied from class:Connection
Indicate to conduit handlers that reads have been closed.- Specified by:
notifyReadClosed
in classConnection
-
notifyWriteClosed
protected void notifyWriteClosed()Description copied from class:Connection
Indicate to conduit handlers that writes have been closed.- Specified by:
notifyWriteClosed
in classConnection
-
getCloseListener
Description copied from interface:CloseListenerSettable
Get the close listener.- Specified by:
getCloseListener
in interfaceCloseListenerSettable<StreamConnection>
- Returns:
- the close listener
-
getCloseSetter
Description copied from interface:CloseableChannel
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.- Specified by:
getCloseSetter
in interfaceBoundChannel
- Specified by:
getCloseSetter
in interfaceCloseableChannel
- Specified by:
getCloseSetter
in 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
-