final class LocalChannel extends AbstractHandleableCloseable<Channel> implements Channel
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
LocalChannel.In |
(package private) static class |
LocalChannel.Out |
Channel.ReceiverHandleableCloseable.Key| Modifier and Type | Field and Description |
|---|---|
private Attachments |
attachments |
private int |
bufferSize |
private boolean |
closed |
private ConnectionHandlerContext |
connectionHandlerContext |
private java.lang.Object |
lock |
private Channel.Receiver |
messageHandler |
private java.util.Queue<LocalChannel.In> |
messageQueue |
private LocalChannel |
otherSide |
private int |
queueLength |
| Constructor and Description |
|---|
LocalChannel(java.util.concurrent.Executor executor,
ConnectionHandlerContext connectionHandlerContext) |
LocalChannel(java.util.concurrent.Executor executor,
LocalChannel otherSide,
ConnectionHandlerContext connectionHandlerContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeAction()
Called exactly once when the
close() method is invoked; the actual close operation should take place here. |
private void |
executeEndTask(Channel.Receiver handler) |
private void |
executeMessageTask(Channel.Receiver handler,
LocalChannel.In in) |
Attachments |
getAttachments()
Get the attachments for this entity.
|
Connection |
getConnection()
Get the connection associated with this channel.
|
<T> T |
getOption(org.xnio.Option<T> option)
Get the value of a channel option.
|
(package private) LocalChannel |
getOtherSide() |
void |
receiveMessage(Channel.Receiver handler)
Initiate processing of the next message, when it comes in.
|
<T> T |
setOption(org.xnio.Option<T> option,
T value)
Set an option for this channel.
|
boolean |
supportsOption(org.xnio.Option<?> option)
Determine whether an option is supported on this channel.
|
MessageOutputStream |
writeMessage()
Write a new message on to this channel, blocking if necessary.
|
void |
writeShutdown()
Send an end-of-messages signal to the remote side.
|
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, checkOpen, close, closeAsync, closeComplete, closeFailed, finalize, getExecutor, isOpenclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCloseHandler, awaitClosed, awaitClosedUninterruptibly, closeAsyncprivate final Attachments attachments
private final LocalChannel otherSide
private final ConnectionHandlerContext connectionHandlerContext
private final java.util.Queue<LocalChannel.In> messageQueue
private final java.lang.Object lock
private final int queueLength
private final int bufferSize
private Channel.Receiver messageHandler
private boolean closed
LocalChannel(java.util.concurrent.Executor executor,
LocalChannel otherSide,
ConnectionHandlerContext connectionHandlerContext)
LocalChannel(java.util.concurrent.Executor executor,
ConnectionHandlerContext connectionHandlerContext)
public MessageOutputStream writeMessage() throws java.io.IOException
ChannelwriteMessage in interface Channeljava.io.IOException - if a new message cannot be writtenpublic void writeShutdown()
throws java.io.IOException
ChannelwriteShutdown in interface Channeljava.io.IOException - if the message could not be writtenpublic void receiveMessage(Channel.Receiver handler)
ChannelreceiveMessage in interface Channelhandler - the handler for the next incoming messagepublic boolean supportsOption(org.xnio.Option<?> option)
ChannelsupportsOption in interface ChannelsupportsOption in interface org.xnio.channels.Configurableoption - the optiontrue if it is supportedpublic <T> T getOption(org.xnio.Option<T> option)
Channelpublic <T> T setOption(org.xnio.Option<T> option,
T value)
throws java.lang.IllegalArgumentException
ChannelsetOption in interface ChannelsetOption in interface org.xnio.channels.ConfigurableT - the type of the option valueoption - the option to setvalue - the value of the option to setjava.lang.IllegalArgumentException - if the value is not acceptable for this optionprivate void executeEndTask(Channel.Receiver handler)
private void executeMessageTask(Channel.Receiver handler, LocalChannel.In in)
public Attachments getAttachments()
AttachablegetAttachments in interface Attachablepublic Connection getConnection()
ChannelgetConnection in interface Channelprotected void closeAction()
throws java.io.IOException
AbstractHandleableCloseableclose() method is invoked; the actual close operation should take place here.
This method must call AbstractHandleableCloseable.closeComplete(), directly or indirectly, for the close operation to finish
(it may happen in another thread but it must happen).
This method should not expect the AbstractHandleableCloseable.closeComplete() call to be made from another thread from the same thread pool
that may cause AbstractHandleableCloseable.close(). As close will block, this can result in situations where all threads in the pool are
blocked on AbstractHandleableCloseable.close() method calls, which means the AbstractHandleableCloseable.closeComplete() will never be run.closeAction in class AbstractHandleableCloseable<Channel>RemotingException - if the close failedjava.io.IOExceptionLocalChannel getOtherSide()