- java.lang.Object
-
- org.xnio.Connection
-
- org.xnio.MessageConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.InterruptibleChannel,BoundChannel,CloseableChannel,CloseListenerSettable<MessageConnection>,Configurable,ConnectedChannel
public abstract class MessageConnection extends Connection implements CloseListenerSettable<MessageConnection>
A message-oriented 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 protectedMessageConnection(XnioIoThread thread)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelListener<? super MessageConnection>getCloseListener()Get the close listener.ChannelListener.Setter<MessageConnection>getCloseSetter()Get the setter which can be used to change the close listener for this channel.ConduitWritableMessageChannelgetSinkChannel()Get the sink channel.ConduitReadableMessageChannelgetSourceChannel()Get the source channel.voidsetCloseListener(ChannelListener<? super MessageConnection> listener)Set the close listener.protected voidsetSinkConduit(MessageSinkConduit conduit)protected voidsetSourceConduit(MessageSourceConduit conduit)-
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
-
MessageConnection
protected MessageConnection(XnioIoThread thread)
Construct a new instance.- Parameters:
thread- the I/O thread
-
-
Method Detail
-
setCloseListener
public void setCloseListener(ChannelListener<? super MessageConnection> listener)
Description copied from interface:CloseListenerSettableSet the close listener.- Specified by:
setCloseListenerin interfaceCloseListenerSettable<MessageConnection>- Parameters:
listener- the close listener
-
getCloseListener
public ChannelListener<? super MessageConnection> getCloseListener()
Description copied from interface:CloseListenerSettableGet the close listener.- Specified by:
getCloseListenerin interfaceCloseListenerSettable<MessageConnection>- Returns:
- the close listener
-
getCloseSetter
public ChannelListener.Setter<MessageConnection> 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(MessageSourceConduit conduit)
-
setSinkConduit
protected void setSinkConduit(MessageSinkConduit conduit)
-
getSourceChannel
public ConduitReadableMessageChannel getSourceChannel()
Get the source channel.- Returns:
- the source channel
-
getSinkChannel
public ConduitWritableMessageChannel getSinkChannel()
Get the sink channel.- Returns:
- the sink channel
-
-