public class MessageProtocol extends java.lang.Object implements MessageLink, ChannelProtocol, java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static java.util.concurrent.atomic.AtomicInteger |
logQueueCt |
static java.util.concurrent.atomic.AtomicInteger |
logQueueCtF |
static java.util.concurrent.atomic.AtomicInteger |
logQueueCtL |
static java.util.concurrent.atomic.AtomicLong |
logQueueNano |
static java.util.concurrent.atomic.AtomicLong |
logQueueNanoF |
static java.util.concurrent.atomic.AtomicLong |
logQueueNanoL |
static java.util.concurrent.atomic.AtomicLong |
logQueueNanoM |
| Constructor and Description |
|---|
MessageProtocol(NodeDetails inLinkedTo,
int inMaxChannels) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection used by this message handler.
|
EventDispatcher |
getDispatcher()
Deprecated.
|
EventHandler<? super MessageEvent> |
getEventHandler()
Deprecated.
|
EventProcessor<MessageEvent> |
getEventProcessor()
Deprecated.
|
NodeDetails |
getLinkedTo() |
LinkStatistics |
getRecvStats() |
LinkStatistics |
getSendStats() |
long |
getWriteQueueSize()
Deprecated.
|
boolean |
isAlive() |
boolean |
isClient() |
void |
onClose(ChannelManager inManager)
Indicate that the channel used by this protocol has closed.
|
boolean |
onRecvBuffer(ChannelManager inManager,
java.nio.ByteBuffer inBuffer)
Called by a channel reader task to pass received bytes to the protocol.
|
boolean |
onSendBuffer(ChannelManager inManager,
java.nio.ByteBuffer inBuffer)
Called by a channel writer task to obtain bytes to send from the protocol.
|
MessageProtocol |
openVirtual() |
void |
sendMessage(MessageEvent inMessage)
Send a message to the connected destination.
|
<M extends MessageEvent> |
sendMessage(MessageEvent sendMsg,
java.lang.Class<M> respType)
Send a message to the connected destination, and get a reply task.
|
void |
setEventHandler(EventHandler<? super MessageEvent> inHandler)
Set the event handler that incoming events are passed to.
|
void |
setEventProcessor(EventProcessor<MessageEvent> inProcess)
Set the event handler that incoming events are passed to.
|
public static java.util.concurrent.atomic.AtomicInteger logQueueCt
public static java.util.concurrent.atomic.AtomicLong logQueueNano
public static java.util.concurrent.atomic.AtomicLong logQueueNanoM
public static java.util.concurrent.atomic.AtomicInteger logQueueCtL
public static java.util.concurrent.atomic.AtomicLong logQueueNanoL
public static java.util.concurrent.atomic.AtomicInteger logQueueCtF
public static java.util.concurrent.atomic.AtomicLong logQueueNanoF
public MessageProtocol(NodeDetails inLinkedTo, int inMaxChannels)
public NodeDetails getLinkedTo()
getLinkedTo in interface MessageLinkpublic boolean isAlive()
isAlive in interface MessageLinkpublic boolean isClient()
isClient in interface MessageLinkpublic LinkStatistics getRecvStats()
getRecvStats in interface MessageLinkpublic LinkStatistics getSendStats()
getSendStats in interface MessageLink@Deprecated public EventDispatcher getDispatcher()
getDispatcher in interface MessageLink@Deprecated public EventHandler<? super MessageEvent> getEventHandler()
getEventHandler in interface MessageLinkpublic void setEventHandler(EventHandler<? super MessageEvent> inHandler) throws LinkException
MessageLinksetEventHandler in interface MessageLinkLinkException@Deprecated public EventProcessor<MessageEvent> getEventProcessor()
getEventProcessor in interface MessageLinkpublic void setEventProcessor(EventProcessor<MessageEvent> inProcess) throws LinkException
MessageLinksetEventProcessor in interface MessageLinkLinkExceptionpublic boolean onRecvBuffer(ChannelManager inManager, java.nio.ByteBuffer inBuffer) throws java.io.IOException
ChannelProtocolonRecvBuffer in interface ChannelProtocolinManager - - The manager performing the read.inBuffer - - The (partially) filled direct buffer.java.io.IOExceptionpublic void sendMessage(MessageEvent inMessage) throws LinkException
MessageLinksendMessage in interface MessageLinkinMessage - - The message to send.LinkExceptionpublic <M extends MessageEvent> Task<M> sendMessage(MessageEvent sendMsg, java.lang.Class<M> respType) throws LinkException
MessageLinksendMessage in interface MessageLinksendMsg - - The message to send.respType - - The class of the expected response message.LinkExceptionpublic boolean onSendBuffer(ChannelManager inManager, java.nio.ByteBuffer inBuffer) throws java.io.IOException
ChannelProtocolonSendBuffer in interface ChannelProtocolinManager - - The manager requesting to write.inBuffer - - A buffer to be filled by the protocol.java.io.IOException@Deprecated public long getWriteQueueSize()
getWriteQueueSize in interface ChannelProtocolpublic MessageProtocol openVirtual() throws LinkException
LinkExceptionpublic void onClose(ChannelManager inManager)
ChannelProtocolonClose in interface ChannelProtocolinManager - - The channel manager that has closed.public void close()
MessageLinkclose in interface MessageLinkclose in interface java.lang.AutoCloseable