final class RemoteConnectionChannel extends AbstractHandleableCloseable<Channel> implements Channel
Channel.ReceiverHandleableCloseable.Key| Constructor and Description |
|---|
RemoteConnectionChannel(RemoteConnectionHandler connectionHandler,
RemoteConnection connection,
int channelId,
int outboundWindow,
int inboundWindow,
int maxOutboundMessages,
int maxInboundMessages,
long maxOutboundMessageSize,
long maxInboundMessageSize) |
| Modifier and Type | Method and Description |
|---|---|
(package private) org.xnio.Pooled<java.nio.ByteBuffer> |
allocate(byte protoId) |
private void |
asyncCloseMessage(int id) |
private boolean |
casState(int oldState,
int newState) |
protected void |
closeAction()
Called exactly once when the
close() method is invoked; the actual close operation should take place here. |
(package private) void |
closeInboundMessage() |
private void |
closeMessages() |
(package private) void |
closeOutboundMessage() |
(package private) void |
closeReads() |
(package private) boolean |
closeReadsAndWrites() |
(package private) boolean |
closeWrites() |
(package private) void |
dumpState(java.lang.StringBuilder b) |
(package private) void |
free(OutboundMessage outboundMessage) |
(package private) void |
freeInboundMessage(short id) |
Attachments |
getAttachments()
Get the attachments for this entity.
|
(package private) int |
getChannelId() |
Connection |
getConnection()
Get the connection associated with this channel.
|
(package private) RemoteConnectionHandler |
getConnectionHandler() |
<T> T |
getOption(org.xnio.Option<T> option)
Get the value of a channel option.
|
(package private) RemoteConnection |
getRemoteConnection() |
(package private) void |
handleAsyncClose(org.xnio.Pooled<java.nio.ByteBuffer> pooled) |
(package private) void |
handleIncomingWriteShutdown() |
(package private) void |
handleMessageData(org.xnio.Pooled<java.nio.ByteBuffer> message) |
(package private) void |
handleRemoteClose() |
(package private) void |
handleWindowOpen(org.xnio.Pooled<java.nio.ByteBuffer> pooled) |
private int |
incrementState(int count) |
private void |
notifyEnd() |
(package private) boolean |
openInboundMessage() |
(package private) void |
openOutboundMessage() |
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.
|
java.lang.String |
toString() |
private void |
unregister() |
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, wait, wait, waitaddCloseHandler, awaitClosed, awaitClosedUninterruptibly, closeAsyncstatic final IntIndexer<RemoteConnectionChannel> INDEXER
private final RemoteConnectionHandler connectionHandler
private final ConnectionHandlerContext connectionHandlerContext
private final RemoteConnection connection
private final int channelId
private final IntIndexMap<OutboundMessage> outboundMessages
private final IntIndexMap<InboundMessage> inboundMessages
private final int outboundWindow
private final int inboundWindow
private final Attachments attachments
private final java.util.Queue<InboundMessage> inboundMessageQueue
private final int maxOutboundMessages
private final int maxInboundMessages
private final long maxOutboundMessageSize
private final long maxInboundMessageSize
private volatile int channelState
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<RemoteConnectionChannel> channelStateUpdater
private Channel.Receiver nextReceiver
private static final int WRITE_CLOSED
private static final int READ_CLOSED
private static final int OUTBOUND_MESSAGES_MASK
private static final int ONE_OUTBOUND_MESSAGE
private static final int INBOUND_MESSAGES_MASK
private static final int ONE_INBOUND_MESSAGE
private static java.util.Set<org.xnio.Option<?>> SUPPORTED_OPTIONS
RemoteConnectionChannel(RemoteConnectionHandler connectionHandler, RemoteConnection connection, int channelId, int outboundWindow, int inboundWindow, int maxOutboundMessages, int maxInboundMessages, long maxOutboundMessageSize, long maxInboundMessageSize)
void openOutboundMessage()
throws java.io.IOException
java.io.IOExceptionprivate int incrementState(int count)
private boolean casState(int oldState,
int newState)
void closeOutboundMessage()
boolean openInboundMessage()
void closeInboundMessage()
void closeReads()
boolean closeWrites()
boolean closeReadsAndWrites()
private void notifyEnd()
private void unregister()
public MessageOutputStream writeMessage() throws java.io.IOException
ChannelwriteMessage in interface Channeljava.io.IOException - if a new message cannot be writtenvoid free(OutboundMessage outboundMessage)
public void writeShutdown()
throws java.io.IOException
ChannelwriteShutdown in interface Channeljava.io.IOException - if the message could not be writtenvoid handleRemoteClose()
void handleIncomingWriteShutdown()
public 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 optionvoid handleMessageData(org.xnio.Pooled<java.nio.ByteBuffer> message)
private void asyncCloseMessage(int id)
void handleWindowOpen(org.xnio.Pooled<java.nio.ByteBuffer> pooled)
void handleAsyncClose(org.xnio.Pooled<java.nio.ByteBuffer> pooled)
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.IOExceptionprivate void closeMessages()
RemoteConnection getRemoteConnection()
RemoteConnectionHandler getConnectionHandler()
int getChannelId()
void freeInboundMessage(short id)
org.xnio.Pooled<java.nio.ByteBuffer> allocate(byte protoId)
public java.lang.String toString()
toString in class java.lang.Objectvoid dumpState(java.lang.StringBuilder b)