|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectt3.remotehrd.server.RemoteHRDServer
public class RemoteHRDServer
This class represents a RemoteHRD server. It has a HRD StateManager, and changes to the state are broadcast to any connected RemoteHRDClients.
You can use its StateManager as usual but with some restrictions: you must synchronize on it before you use it, or its Tiles, Cursors or Links; and you must call endOfBurst to ensure that changes get sent on to the clients.
We have one listener thread that listens for new connections. It does:
We have one thread per client that receives and processes messages from that client. * It does:
To send a message to all clients you call the manager's addToSendQueue method. If you perform operations on the StateManager or one if its Tiles, Links or Cursors then a message will automatically be generated and the addToSendQueue method invoked.
When you call addToSendQueue, the message is not sent immediately; instead it is added to a queue and might not be sent until you call endOfBurst. Messages within a burst might be amalgamated to save processing time and network bandwidth.
There are two modes for sending:
| Field Summary | |
|---|---|
java.util.Map<java.lang.Integer,Client> |
allClientsClientIdToClientsImmutable
|
RemoteHRDServerCallBacks |
callBacks
|
StateManager |
stateManager
See notes above. |
| Constructor Summary | |
|---|---|
RemoteHRDServer(java.net.ServerSocket serverSocket,
java.net.ServerSocket inputSourceServerSocket,
RemoteHRDServerCallBacks callBacks,
boolean alwaysServerPush)
Creates a RemoteHRDServer and starts the listening thread. |
|
| Method Summary | |
|---|---|
void |
addToSendQueue(java.io.Serializable msg)
Add a message to the send queue. |
void |
endOfUpdateFrame()
Indicates that queued messages can be sent through to the client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.util.Map<java.lang.Integer,Client> allClientsClientIdToClientsImmutable
public final RemoteHRDServerCallBacks callBacks
public final StateManager stateManager
| Constructor Detail |
|---|
public RemoteHRDServer(java.net.ServerSocket serverSocket,
java.net.ServerSocket inputSourceServerSocket,
RemoteHRDServerCallBacks callBacks,
boolean alwaysServerPush)
serverSocket - callBacks - alwaysServerPush - | Method Detail |
|---|
public void addToSendQueue(java.io.Serializable msg)
msg - public void endOfUpdateFrame()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||