|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.ganymede.serverClientProxy
serverClientProxy is a partial server-side Client proxy object which buffers async client updates, coalescing update events as needed to maximize server efficiency. Each serverClientProxy object has a background thread which communicates with a remote Client in the background, allowing the Ganymede server's operations to be asynchronous with respect to Client messages.
clientEvent| Field Summary | |
private static int |
classCounter
Used to generate a unique name for our background thread. |
private arlut.csd.ganymede.Client |
client
Our remote reference to the Client |
private java.lang.Thread |
commThread
Our background communications thread, which is responsible for calling the remote Client via RMI. |
private int |
dequeuePtr
Index pointer to the slot for the next item to be pulled from |
private boolean |
done
If true, we have been told to shut down, and our background commThread will exit as soon as it can clear its event queue. |
private int |
ebSz
Current counter for how many events we have queued |
private int |
enqueuePtr
Index pointer to the slot for the next item to be place in |
private java.lang.String |
errorCondition
If our commThread receives a remote exception when communicating with a remote Client, this field will become non-null, and no more communications will be attempted with that client. |
private arlut.csd.ganymede.clientEvent[] |
eventBuffer
Our queue of clientEvent objects. |
private arlut.csd.ganymede.clientEvent[] |
lookUp
Handy direct look-up table for events in eventBuffer |
private int |
maxBufferSize
How many events we'll queue up before deciding that the Client isn't responding. |
| Constructor Summary | |
serverClientProxy(arlut.csd.ganymede.Client client)
|
|
| Method Summary | |
private void |
addEvent(arlut.csd.ganymede.clientEvent newEvent)
private helper method in serverClientProxy, used to add an event to the proxy's event buffer. |
private arlut.csd.ganymede.clientEvent |
dequeue()
private dequeue method. |
private void |
enqueue(arlut.csd.ganymede.clientEvent item)
private enqueue method. |
boolean |
isAlive()
Returns true if we are successfully in communications with the attached Client. |
private void |
replaceEvent(arlut.csd.ganymede.clientEvent newEvent)
private helper method in serverClientProxy, used to add an event to the proxy's event buffer. |
void |
run()
The serverClientProxy's background thread's run() method. |
void |
sendMessage(int type,
java.lang.String message)
This method is used to submit a message to be sent to the client. |
void |
shutdown()
This method shuts down the background thread. |
private void |
throwOverflow()
This method throws a remoteException which describes the state of the event buffer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static int classCounter
Used to generate a unique name for our background thread.
private arlut.csd.ganymede.Client client
Our remote reference to the Client
private java.lang.Thread commThread
Our background communications thread, which is responsible for calling the remote Client via RMI.
private final arlut.csd.ganymede.clientEvent[] eventBuffer
Our queue of clientEvent objects.
private int enqueuePtr
Index pointer to the slot for the next item to be place in
private int dequeuePtr
Index pointer to the slot for the next item to be pulled from
private int ebSz
Current counter for how many events we have queued
private final int maxBufferSize
How many events we'll queue up before deciding that the Client isn't responding.
private volatile boolean done
If true, we have been told to shut down, and our background commThread will exit as soon as it can clear its event queue.
.
private java.lang.String errorCondition
If our commThread receives a remote exception when communicating with a remote Client, this field will become non-null, and no more communications will be attempted with that client.
private arlut.csd.ganymede.clientEvent[] lookUp
Handy direct look-up table for events in eventBuffer
| Constructor Detail |
public serverClientProxy(arlut.csd.ganymede.Client client)
| Method Detail |
public boolean isAlive()
Returns true if we are successfully in communications with the attached Client.
public void shutdown()
This method shuts down the background thread.
public void sendMessage(int type,
java.lang.String message)
throws java.rmi.RemoteException
This method is used to submit a message to be sent to the client. If the serverClientProxy has already had its shutdown() method called, sendMessage() will silently fail, and the message will not be queued.
java.rmi.RemoteExceptionpublic void run()
The serverClientProxy's background thread's run() method. This method runs in the Client proxy thread to read events from this console's serverClientProxy eventBuffer and send them down to the Client.
run in interface java.lang.Runnable
private void addEvent(arlut.csd.ganymede.clientEvent newEvent)
throws java.rmi.RemoteException
private helper method in serverClientProxy, used to add an event to the proxy's event buffer. If the buffer already contains an event of the same type as newEvent, both events will be sent to the Client, in chronological order.
java.rmi.RemoteException
private void replaceEvent(arlut.csd.ganymede.clientEvent newEvent)
throws java.rmi.RemoteException
private helper method in serverClientProxy, used to add an event to the proxy's event buffer. If the buffer already contains an event of the same type as newEvent, the old event's contents will be replaced with the new, and the remote client will never be notified of the old event's contents.
java.rmi.RemoteException
private void throwOverflow()
throws java.rmi.RemoteException
This method throws a remoteException which describes the state of the event buffer. This is called from addEvent and replaceEvent.
java.rmi.RemoteExceptionprivate void enqueue(arlut.csd.ganymede.clientEvent item)
private arlut.csd.ganymede.clientEvent dequeue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||