|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsgDomainAdapter
org.jlab.coda.cMsg.RCServerDomain.RCServer
public class RCServer
This class implements the runcontrol server (rcs) domain.
Field Summary |
---|
Fields inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter |
---|
connected, description, domain, host, name, receiving, shutdownHandler, UDL, UDLremainder |
Constructor Summary | |
---|---|
RCServer()
Constructor. |
Method Summary | |
---|---|
void |
connect()
Method to connect to the rc client from this server. |
void |
disconnect()
Method to close the connection to the rc client. |
java.lang.String |
getString()
Returns a string back to the top level API user indicating the name of the client that this server is communicating with. |
void |
send(cMsgMessage message)
Method to send a message/command to the rc client. |
cMsgMessage |
sendAndGet(cMsgMessage message,
int timeout)
The message is sent as it would be in the send(org.jlab.coda.cMsg.cMsgMessage) method except that the
senderToken and creator are set. |
java.lang.Object |
subscribe(java.lang.String subject,
java.lang.String type,
cMsgCallbackInterface cb,
java.lang.Object userObj)
This is a method to subscribe to receive messages of a subject and type from the rc client. |
cMsgMessage |
subscribeAndGet(java.lang.String subject,
java.lang.String type,
int timeout)
This method is like a one-time subscribe. |
void |
unsubscribe(java.lang.Object obj)
Method to unsubscribe a previous subscription. |
Methods inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter |
---|
flush, getDescription, getDomain, getHost, getName, getShutdownHandler, getUDL, getUDLRemainder, isConnected, isReceiving, monitor, setDescription, setName, setShutdownHandler, setUDL, setUDLRemainder, shutdownClients, shutdownServers, start, stop, syncSend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RCServer() throws cMsgException
cMsgException
Method Detail |
---|
public java.lang.String getString()
getString
in interface cMsgDomainInterface
getString
in class cMsgDomainAdapter
public void connect() throws cMsgException
connect
in interface cMsgDomainInterface
connect
in class cMsgDomainAdapter
cMsgException
- if there are problems parsing the UDL,
communication problems with the client,
or cannot start up a TCP listening threadpublic void disconnect()
disconnect
in interface cMsgDomainInterface
disconnect
in class cMsgDomainAdapter
public void send(cMsgMessage message) throws cMsgException
send
in interface cMsgDomainInterface
send
in class cMsgDomainAdapter
message
- message to send
cMsgException
- if there are communication problems with the server;
text is null or blankpublic java.lang.Object subscribe(java.lang.String subject, java.lang.String type, cMsgCallbackInterface cb, java.lang.Object userObj) throws cMsgException
subscribe
in interface cMsgDomainInterface
subscribe
in class cMsgDomainAdapter
subject
- message subjecttype
- message typecb
- callback object whose single method is called upon receiving a message
of subject and typeuserObj
- any user-supplied object to be given to the callback method as an argument
cMsgException
- if the callback is null; an identical subscription already exists;
if not connected to an rc clientpublic void unsubscribe(java.lang.Object obj) throws cMsgException
unsubscribe
in interface cMsgDomainInterface
unsubscribe
in class cMsgDomainAdapter
obj
- the object "handle" returned from a subscribe call
cMsgException
- if there is no connection with the rc client; obj is nullpublic cMsgMessage subscribeAndGet(java.lang.String subject, java.lang.String type, int timeout) throws cMsgException, java.util.concurrent.TimeoutException
subscribeAndGet
in interface cMsgDomainInterface
subscribeAndGet
in class cMsgDomainAdapter
subject
- subject of message desired from servertype
- type of message desired from servertimeout
- time in milliseconds to wait for a message
cMsgException
- if there are communication problems with rc client;
subject and/or type is null or blank
java.util.concurrent.TimeoutException
- if timeout occurspublic cMsgMessage sendAndGet(cMsgMessage message, int timeout) throws cMsgException, java.util.concurrent.TimeoutException
send(org.jlab.coda.cMsg.cMsgMessage)
method except that the
senderToken and creator are set. A marked response can be received from a client
regardless of its subject or type.
NOTE: Disconnecting when one thread is in the waiting part of a sendAndGet may cause that
thread to block forever. It is best to always use a timeout with sendAndGet so the thread
is assured of eventually resuming execution.
sendAndGet
in interface cMsgDomainInterface
sendAndGet
in class cMsgDomainAdapter
message
- message sent to clienttimeout
- time in milliseconds to wait for a reponse message
cMsgException
- if there are communication problems with the client;
subject and/or type is null or blank
java.util.concurrent.TimeoutException
- if timeout occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |