public class cMsgMessageDeliverer extends java.lang.Object implements cMsgDeliverMessageInterface
This class delivers messages from the subdomain handler objects in the cMsg domain to a particular client.
Various types of messages may be sent. These are defined to be:
cMsgConstants.msgGetResponse
for a message sent in
response to a cMsg.sendAndGet(org.jlab.coda.cMsg.cMsgMessage, int)
cMsgConstants.msgServerGetResponse
for a message sent in
response to a cMsgServerClient.serverSendAndGet(org.jlab.coda.cMsg.cMsgMessage, java.lang.String, org.jlab.coda.cMsg.cMsgCallbackInterface)
with a return acknowlegment
cMsgConstants.msgSubscribeResponse
for a message sent in
response to a cMsg.subscribe(java.lang.String, java.lang.String, org.jlab.coda.cMsg.cMsgCallbackInterface, java.lang.Object)
with a return acknowlegment
cMsgConstants.msgShutdownClients
for a message to shutdown
the receiving client
cMsgConstants.msgSyncSendResponse
for an int sent in
response to a cMsg.syncSend(org.jlab.coda.cMsg.cMsgMessage, int)
cMsgConstants.msgServerRegistrationLockResponse
for an int sent in
response to a cMsgServerClient.registrationLock(int)
cMsgConstants.msgServerCloudLockResponse
for an int sent in
response to a cMsgServerClient.cloudLock(int)
cMsgConstants.msgServerSendClientNamesResponse
for an int sent in
response to a cMsgServerClient.getClientNamesAndNamespaces()
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
blocking |
(package private) java.nio.ByteBuffer |
buffer
Direct buffer for writing nonblocking IO.
|
Constructor and Description |
---|
cMsgMessageDeliverer()
Create a message delivering object for use with one specific client.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Method to close all streams and sockets.
|
void |
createClientConnection(java.nio.channels.SocketChannel channel,
boolean blocking)
Creates a socket communication channel to a client.
|
void |
deliverMessage(cMsgMessage msg,
int msgType)
Method to deliver a message from a domain server's subdomain handler to a client.
|
void |
deliverMessage(int i,
int j,
int msgType)
Method to deliver an integer from a domain server's subdomain handler to a client.
|
void |
deliverMessage(java.lang.String[] strs,
int msgType)
Method to deliver an array of string from a domain server's subdomain handler to a client.
|
boolean blocking
java.nio.ByteBuffer buffer
public cMsgMessageDeliverer() throws java.io.IOException
java.io.IOException
- if cannot establish communication with clientpublic void close()
close
in interface cMsgDeliverMessageInterface
public void deliverMessage(cMsgMessage msg, int msgType) throws java.io.IOException, cMsgException
deliverMessage
in interface cMsgDeliverMessageInterface
msg
- message to sent to clientmsgType
- type of communication with the clientjava.io.IOException
- if the message cannot be sent over the channel
or client returns an errorcMsgException
- if connection to client has not been establishedpublic void deliverMessage(int i, int j, int msgType) throws java.io.IOException, cMsgException
deliverMessage
in interface cMsgDeliverMessageInterface
i
- integer to sent to clientj
- integer to sent to clientmsgType
- type of communication with the clientjava.io.IOException
- if the message cannot be sent over the channel
or client returns an errorcMsgException
- if connection to client has not been establishedpublic void deliverMessage(java.lang.String[] strs, int msgType) throws java.io.IOException, cMsgException
deliverMessage
in interface cMsgDeliverMessageInterface
strs
- array of strings to sent to clientmsgType
- type of communication with the clientjava.io.IOException
- if the message cannot be sent over the channel
or client returns an errorcMsgException
- if connection to client has not been establishedpublic void createClientConnection(java.nio.channels.SocketChannel channel, boolean blocking) throws java.io.IOException
channel
- channel to clientblocking
- is socket blocking (true) or nonblocking (false) ?java.io.IOException
- if socket cannot be created