Top Description Fields Constructors Methods
org.xnio

public abstract Class StreamConnection

extends Connection
implements CloseListenerSettable<StreamConnection>
Class Inheritance
All Implemented Interfaces
org.xnio.channels.CloseListenerSettable
Known Direct Subclasses
org.xnio.ssl.SslConnection
Imports
java.io.IOException, java.util.concurrent.atomic.AtomicReference, org.jboss.logging.Logger, org.xnio.channels.CloseListenerSettable, org.xnio.conduits.ConduitStreamSinkChannel, .ConduitStreamSourceChannel, .StreamSinkConduit, .StreamSourceConduit

A connection between peers.
Authors
David M. Lloyd, Flavia Rainone

Field Summary

Modifier and TypeField and Description
private AtomicReference<ChannelListener<? super StreamConnection>>
private static final ChannelListener<? super StreamConnection>
INVOKED_CLOSE_LISTENER_FLAG

An empty listener used as a flag, to indicate that close listener has been invoked.

private static final Logger
private ConduitStreamSinkChannel
private ConduitStreamSourceChannel
Inherited from org.xnio.Connection:
thread

Constructor Summary

AccessConstructor and Description
protected
StreamConnection(final XnioIoThread
the I/O thread
thread
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public ChannelListener<? super StreamConnection>
public ChannelListener.Setter<? extends StreamConnection>
getCloseSetter()

Implements org.xnio.channels.CloseableChannel.getCloseSetter, org.xnio.channels.ConnectedChannel.getCloseSetter.

Get the setter which can be used to change the close listener for this channel.

public ConduitStreamSinkChannel

Returns:

the sink channel
getSinkChannel
()

Get the sink channel.

public ConduitStreamSourceChannel

Returns:

the source channel
getSourceChannel
()

Get the source channel.

pack-priv void
private final ChannelListener<? super StreamConnection>
mergeListeners(final ChannelListener<? super StreamConnection> listener1, final ChannelListener<? super StreamConnection> listener2)

protected void
notifyReadClosed()

Implements abstract org.xnio.Connection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

protected void
notifyWriteClosed()

Implements abstract org.xnio.Connection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

private static <T> T
notNull(T orig)

public void
setCloseListener(final ChannelListener<? super StreamConnection>
the close listener
listener
)

Implements org.xnio.channels.CloseListenerSettable.setCloseListener.

Set the close listener.

protected void
setSinkConduit(StreamSinkConduit
the sink conduit for this channel
conduit
)

Set the sink conduit for this channel.

protected void
setSourceConduit(StreamSourceConduit
the source conduit for this channel
conduit
)

Set the source conduit for this channel.

Inherited from org.xnio.Connection:
closecloseActiongetIoThreadgetLocalAddressgetOptiongetPeerAddressgetWorkerisOpenisReadShutdownisWriteShutdownreadClosedsetOptionsupportsOptionwriteClosed

Field Detail

closeListenerback to summary
private AtomicReference<ChannelListener<? super StreamConnection>> closeListener
INVOKED_CLOSE_LISTENER_FLAGback to summary
private static final ChannelListener<? super StreamConnection> INVOKED_CLOSE_LISTENER_FLAG

An empty listener used as a flag, to indicate that close listener has been invoked.

logback to summary
private static final Logger log
sinkChannelback to summary
private ConduitStreamSinkChannel sinkChannel
sourceChannelback to summary
private ConduitStreamSourceChannel sourceChannel

Constructor Detail

StreamConnectionback to summary
protected StreamConnection(final XnioIoThread thread)

Construct a new instance.

Parameters
thread:XnioIoThread

the I/O thread

Method Detail

getCloseListenerback to summary
public ChannelListener<? super StreamConnection> getCloseListener()

Implements org.xnio.channels.CloseListenerSettable.getCloseListener.

Doc from org.xnio.channels.CloseListenerSettable.getCloseListener.

Get the close listener.

Returns:ChannelListener<? super StreamConnection>

the close listener

getCloseSetterback to summary
public ChannelListener.Setter<? extends StreamConnection> getCloseSetter()

Implements org.xnio.channels.CloseableChannel.getCloseSetter, org.xnio.channels.ConnectedChannel.getCloseSetter.

Doc from org.xnio.channels.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:ChannelListener.Setter<? extends StreamConnection>

the setter

getSinkChannelback to summary
public ConduitStreamSinkChannel getSinkChannel()

Get the sink channel.

Returns:ConduitStreamSinkChannel

the sink channel

getSourceChannelback to summary
public ConduitStreamSourceChannel getSourceChannel()

Get the source channel.

Returns:ConduitStreamSourceChannel

the source channel

invokeCloseListenerback to summary
pack-priv void invokeCloseListener()

Implements abstract org.xnio.Connection.invokeCloseListener.

mergeListenersback to summary
private final ChannelListener<? super StreamConnection> mergeListeners(final ChannelListener<? super StreamConnection> listener1, final ChannelListener<? super StreamConnection> listener2)
notifyReadClosedback to summary
protected void notifyReadClosed()

Implements abstract org.xnio.Connection.notifyReadClosed.

Doc from org.xnio.Connection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

Annotations
@Override
notifyWriteClosedback to summary
protected void notifyWriteClosed()

Implements abstract org.xnio.Connection.notifyWriteClosed.

Doc from org.xnio.Connection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

Annotations
@Override
notNullback to summary
private static <T> T notNull(T orig) throws IllegalStateException
setCloseListenerback to summary
public void setCloseListener(final ChannelListener<? super StreamConnection> listener)

Implements org.xnio.channels.CloseListenerSettable.setCloseListener.

Doc from org.xnio.channels.CloseListenerSettable.setCloseListener.

Set the close listener.

Parameters
listener:ChannelListener<? super StreamConnection>

the close listener

setSinkConduitback to summary
protected void setSinkConduit(StreamSinkConduit conduit)

Set the sink conduit for this channel. The sink channel will automatically be updated.

Parameters
conduit:StreamSinkConduit

the sink conduit for this channel

setSourceConduitback to summary
protected void setSourceConduit(StreamSourceConduit conduit)

Set the source conduit for this channel. The source channel will automatically be updated.

Parameters
conduit:StreamSourceConduit

the source conduit for this channel