- 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
-
-
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 protected
StreamConnection(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.ConduitStreamSinkChannel
getSinkChannel()
Get the sink channel.ConduitStreamSourceChannel
getSourceChannel()
Get the source channel.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, notifyReadClosed, notifyWriteClosed, 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:CloseListenerSettable
Set the close listener.- Specified by:
setCloseListener
in interfaceCloseListenerSettable<StreamConnection>
- Parameters:
listener
- the close listener
-
getCloseListener
public ChannelListener<? super StreamConnection> getCloseListener()
Description copied from interface:CloseListenerSettable
Get the close listener.- Specified by:
getCloseListener
in interfaceCloseListenerSettable<StreamConnection>
- Returns:
- the close listener
-
getCloseSetter
public ChannelListener.Setter<? extends StreamConnection> 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
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
-
-