Package org.xnio

# Class MessageConnection

java.lang.Object
org.xnio.Connection
org.xnio.MessageConnection

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Channel`, `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 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`
`MessageConnection(XnioIoThread thread)`
Construct a new instance.

## Method Summary

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.
`ConduitWritableMessageChannel`
`getSinkChannel()`
Get the sink channel.
`ConduitReadableMessageChannel`
`getSourceChannel()`
Get the source channel.
`void`
`setCloseListener(ChannelListener<? super MessageConnection> listener)`
Set the close listener.
`protected void`
`setSinkConduit(MessageSinkConduit conduit)`
`protected void`
`setSourceConduit(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 Details

### MessageConnection

protected MessageConnection(XnioIoThread thread)
Construct a new instance.

Parameters:
  `thread` - the I/O thread

## Method Details

### setCloseListener

public void setCloseListener(ChannelListener<? super MessageConnection> listener)
Description copied from interface: `CloseListenerSettable`
Set the close listener.

Specified by:
  `setCloseListener` in interface `CloseListenerSettable<MessageConnection>`
Parameters:
  `listener` - the close listener

### getCloseListener

public ChannelListener<? super MessageConnection> getCloseListener()
Description copied from interface: `CloseListenerSettable`
Get the close listener.

Specified by:
  `getCloseListener` in interface `CloseListenerSettable<MessageConnection>`
Returns:
  the close listener

### getCloseSetter

public ChannelListener.Setter<MessageConnection> 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 interface `BoundChannel`
Specified by:
  `getCloseSetter` in interface `CloseableChannel`
Specified by:
  `getCloseSetter` in interface `ConnectedChannel`
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