public class RemotingMessageChannel extends TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel> implements ConnectedMessageChannel
FramedMessageChannel to fix
REM3-259 issue.
While slightly modified, it is basically a copy of FramedMessageChannelchannel| Constructor and Description |
|---|
RemotingMessageChannel(ConnectedStreamChannel channel,
ByteBuffer receiveBuffer,
ByteBuffer transmitBuffer)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeAction(boolean readShutDown,
boolean writeShutDown)
The action to perform when the channel is closed via the
TranslatingSuspendableChannel.close() method. |
protected boolean |
flushAction(boolean shutDown)
The action to perform when the channel is flushed.
|
ConnectedStreamChannel |
getChannel()
Get the underlying channel.
|
SocketAddress |
getLocalAddress()
Get the local address that this channel is bound to.
|
<A extends SocketAddress> |
getLocalAddress(Class<A> type)
Get the local address of a given type, or
null if the address is not of that
type. |
SocketAddress |
getPeerAddress()
Get the peer address of this channel.
|
<A extends SocketAddress> |
getPeerAddress(Class<A> type)
Get the peer address of a given type, or
null if the address is not of that
type. |
int |
receive(ByteBuffer buffer)
Receive a message.
|
long |
receive(ByteBuffer[] buffers)
Receive a message.
|
long |
receive(ByteBuffer[] buffers,
int offs,
int len)
Receive a message.
|
boolean |
send(ByteBuffer buffer)
Send a complete message.
|
boolean |
send(ByteBuffer[] buffers)
Send a complete message.
|
boolean |
send(ByteBuffer[] buffers,
int offs,
int len)
Send a complete message.
|
protected void |
shutdownReadsAction(boolean writeComplete)
The action to perform when reads are shut down.
|
protected void |
shutdownWritesComplete(boolean readShutDown)
Notification that the channel has successfully flushed after having shut down writes.
|
awaitReadable, awaitReadable, awaitWritable, awaitWritable, clearReadReady, clearReadRequiresWrite, clearWriteReady, clearWriteRequiresRead, close, flush, getCloseSetter, getOption, getReadSetter, getReadThread, getWorker, getWriteSetter, getWriteThread, handleClosed, handleReadable, handleWritable, isOpen, isReadResumed, isReadShutDown, isWriteComplete, isWriteResumed, isWriteShutDown, readRequiresWrite, removeReadRequiresExternal, removeWriteRequiresExternal, resumeReads, resumeWrites, setClosed, setOption, setReadReady, setReadRequiresWrite, setReadShutDown, setWriteReady, setWriteRequiresRead, setWriteShutDown, shutdownReads, shutdownWrites, shutdownWritesAction, supportsOption, suspendReads, suspendWrites, thisTyped, toString, tryAddReadRequiresExternal, tryAddWriteRequiresExternal, wakeupReads, wakeupWrites, writeRequiresReadclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCloseSetter, getReadSetter, getWriteSetterawaitReadable, awaitReadable, getReadThread, isReadResumed, resumeReads, shutdownReads, suspendReads, wakeupReadsawaitWritable, awaitWritable, close, flush, getWriteThread, isWriteResumed, resumeWrites, shutdownWrites, suspendWrites, wakeupWritesgetWorkergetOption, setOption, supportsOptionpublic RemotingMessageChannel(ConnectedStreamChannel channel, ByteBuffer receiveBuffer, ByteBuffer transmitBuffer)
channel - the channel to wrapreceiveBuffer - the receive buffer (should be direct)transmitBuffer - the send buffer (should be direct)public int receive(ByteBuffer buffer) throws IOException
receive in interface ReadableMessageChannelbuffer - the buffer that will hold the messageIOException - if an I/O error occurspublic long receive(ByteBuffer[] buffers) throws IOException
receive in interface ReadableMessageChannelbuffers - the buffers that will hold the messageIOException - if an I/O error occurspublic long receive(ByteBuffer[] buffers, int offs, int len) throws IOException
receive in interface ReadableMessageChannelbuffers - the buffers that will hold the messageoffs - the offset into the array of buffers of the first buffer to read intolen - the number of buffers to fillIOException - if an I/O error occursprotected void shutdownReadsAction(boolean writeComplete)
throws IOException
TranslatingSuspendableChannelshutdownReadsAction in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>IOException - if an error occurspublic boolean send(ByteBuffer buffer) throws IOException
send in interface WritableMessageChannelbuffer - the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] buffers) throws IOException
send in interface WritableMessageChannelbuffers - the buffers holding the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] buffers, int offs, int len) throws IOException
send in interface WritableMessageChannelbuffers - the buffers holding the message to sendoffs - the offset into the buffer array of the first bufferlen - the number of buffers that contain data to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occursprotected boolean flushAction(boolean shutDown)
throws IOException
TranslatingSuspendableChannelshutDown parameter is set, and this method returns true, the underlying channel will be
shut down and this method will never be called again (future calls to TranslatingSuspendableChannel.flush() will flush the underlying
channel until it returns true).flushAction in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>shutDown - true if the channel's write side has been shut down, false otherwisetrue if the flush succeeded, false if it would blockIOException - if an error occursprotected void shutdownWritesComplete(boolean readShutDown)
throws IOException
TranslatingSuspendableChannelshutdownWritesComplete in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>readShutDown - true if the read side was already shut down, false otherwiseIOException - if an error occursprotected void closeAction(boolean readShutDown,
boolean writeShutDown)
throws IOException
TranslatingSuspendableChannelTranslatingSuspendableChannel.close() method. By default, the underlying
channel is closed.closeAction in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>readShutDown - if reads were previously shut downwriteShutDown - if writes were previously shut downIOException - if an error occurspublic SocketAddress getPeerAddress()
getPeerAddress in interface ConnectedChannelpublic <A extends SocketAddress> A getPeerAddress(Class<A> type)
null if the address is not of that
type.getPeerAddress in interface ConnectedChanneltype - the address type classnull if unknownpublic SocketAddress getLocalAddress()
getLocalAddress in interface BoundChannelpublic <A extends SocketAddress> A getLocalAddress(Class<A> type)
null if the address is not of that
type.getLocalAddress in interface BoundChannelA - the address typetype - the address type classnull if unknownpublic ConnectedStreamChannel getChannel()
getChannel in interface WrappedChannel<ConnectedStreamChannel>getChannel in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>Copyright © 2018 JBoss by Red Hat. All rights reserved.