public class RCMulticast extends cMsgDomainAdapter
Modifier and Type | Class and Description |
---|---|
(package private) class |
RCMulticast.Multicaster
This class defines a thread to multicast a UDP packet to the
RC Multicast server every second.
|
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
acceptingClients
Only allow response to rc clients if server is properly started.
|
(package private) java.lang.String |
expid
Runcontrol's experiment id.
|
(package private) boolean |
hasSubscription
Only allow response to rc clients if we have a subscription to pass client info to.
|
(package private) int |
localTempPort
The local port used temporarily while multicasting for other rc multicast servers.
|
(package private) java.util.concurrent.CountDownLatch |
multicastResponse
Signal to coordinate the multicasting and waiting for responses.
|
(package private) java.lang.String |
respondingHost
The host of the responding server to initial multicast probes of the local subnet.
|
(package private) java.util.Set<cMsgSubscription> |
subscriptions
Collection of all of this server's subscriptions which are
cMsgSubscription objects. |
(package private) int |
udpPort
This runcontrol multicast server's UDP listening port obtained from UDL or default value.
|
connected, debug, description, domain, host, name, receiving, shutdownHandler, UDL, UDLremainder
Constructor and Description |
---|
RCMulticast() |
Modifier and Type | Method and Description |
---|---|
void |
connect()
Method to connect to rc clients from this server.
|
void |
disconnect()
Method to stop listening for packets from rc clients.
|
void |
send(cMsgMessage message)
Method to send an abort command to the rc client.
|
cMsgSubscriptionHandle |
subscribe(java.lang.String subject,
java.lang.String type,
cMsgCallbackInterface cb,
java.lang.Object userObj)
Method to subscribe to receive messages from rc clients.
|
void |
unsubscribe(cMsgSubscriptionHandle obj)
Method to unsubscribe a previous subscription to receive messages of a subject and type
from the domain.
|
flush, getCurrentUDL, getDebug, getDescription, getDomain, getHost, getInfo, getName, getServerHost, getServerPort, getShutdownHandler, getUDL, getUDLRemainder, isConnected, isReceiving, monitor, sendAndGet, setDebug, setDescription, setName, setShutdownHandler, setUDL, setUDLRemainder, shutdownClients, shutdownServers, start, stop, subscribeAndGet, syncSend
int udpPort
int localTempPort
java.util.concurrent.CountDownLatch multicastResponse
java.lang.String respondingHost
java.lang.String expid
volatile boolean acceptingClients
volatile boolean hasSubscription
java.util.Set<cMsgSubscription> subscriptions
cMsgSubscription
objects. This set is synchronized.public RCMulticast() throws cMsgException
cMsgException
public void connect() throws cMsgException
connect
in interface cMsgDomainInterface
connect
in class cMsgDomainAdapter
cMsgException
- if there are problems parsing the UDL or
creating the UDP socketpublic 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 sendcMsgException
- if there are communication problems with the rc clientpublic cMsgSubscriptionHandle 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
- ignored and set to "s"type
- ignored and set to "t"cb
- 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 argumentcMsgException
- if the callback, subject and/or type is null or blank;
an identical subscription already exists; if not connected
to an rc clientpublic void unsubscribe(cMsgSubscriptionHandle obj) throws cMsgException
unsubscribe
in interface cMsgDomainInterface
unsubscribe
in class cMsgDomainAdapter
obj
- the object returned from a subscribe callcMsgException
- if there is no connection with rc clients; object is null