| java.lang.Object chat.business.DiscussionManagerImpl
DiscussionManagerImpl | public DiscussionManagerImpl()(Code) | | |
addMessage | public void addMessage(String name, String txt)(Code) | | Add a message to the discussion. Any waiting clients will be
instantly notified.
|
clear | public void clear()(Code) | | Throw out all the current messages.
All the waiting clients will be immediatly notified.
|
getContents | public Snapshot getContents(long currentState, long wait)(Code) | | Get a snapshot of the current state. Might block.
Parameters: currentState - The state identifier that was returned last time this was called.This is the id of the state that the client currently has. It isasking for a snapshot of the state after things change andthis id is not longer current. If this has already happened, thecall will immediatly return. If it has not happned, the call willblock (not return) until things change. Parameters: wait - The maxmimum number of seconds this call is allowed to block for.Send 0 for an instant response. If the call blocks and thenruns out of time, a snapshot is returned.A Snapshot object. This is just a way to return two things atonce: a Vector of Message objects and a state identifier.The client should use the state identifier for the next call tothis method. The client should call this method again as soon asit is done displaying the results. |
getCurrentSize | public long getCurrentSize()(Code) | | |
getNumWaiting | public int getNumWaiting()(Code) | | How may clients are blocked on a read? This is, effectivly, the
number of people participating in the discussion.
|
getTotalReceived | public long getTotalReceived()(Code) | | |
setMaxQueueSize | public void setMaxQueueSize(int maxQueueSize)(Code) | | |
startHarvester | public void startHarvester(int lifetimeSec, int intervalSec)(Code) | | Call this function (only once) if you want to start the
harverter thread. It runs in the background and periodically
deletes messages that are too old. Most of the time the thread
is sleeping. If this method is not called, then no age limit on
messages will be enforced.
The longest a message can live is lifetimeSec + intervalSec seconds
(in the extreme case).
The default value for the interval is a little shorter than the
default value for the browser's timeout. This is so that if the
browser is left idle (and messages start being deleted), the
refresh cycle will sync up with this threads interval, and
fewer updates will happen (delete, delete, delete... instead of
timout, delete, timeout, delete, timeout, delete...). It's not
a big deal, but hey...
Parameters: lifetimeSec - How long should messages be kept for (seconds). |
stopHarvester | public void stopHarvester()(Code) | | |
|
|