com.purpletech.message.server
Class Splitter
java.lang.Object
|
+--com.purpletech.message.server.Splitter
- All Implemented Interfaces:
- MessageServerListener
- public class Splitter
- extends java.lang.Object
- implements MessageServerListener
The splitter takes a message and multicasts it -- makes N new
messages for each of its N clients and adds them back to the queue.
A "chat channel" client could either subclass or own this object.
- Version:
- $Id: Splitter.java,v 1.2 2001/10/30 12:20:52 alex Exp $
- Author:
- Alex
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
messages
protected Queue messages
clients
protected ClientSet clients
copyWhenCreated
public boolean copyWhenCreated
Splitter
public Splitter(Queue messages,
ClientSet clientsInitial)
addClient
public void addClient(Client c)
removeClient
public void removeClient(Client c)
sendMessage
public void sendMessage(Message m)
- must be synchronized to avoid collision with addClient and
removeClient -- we don't want the iterator to fail-fast, now,
do we?
clientAdded
public void clientAdded(MessageServerEvent e)
- Specified by:
clientAdded in interface MessageServerListener
clientRemoved
public void clientRemoved(MessageServerEvent e)
- Specified by:
clientRemoved in interface MessageServerListener