import java.util.Vector; import java.rmi.*; import java.rmi.server.*; /** * Implementation for the Remote interface PopupServerInterface */ public class PopupServerImpl extends UnicastRemoteObject implements PopupServerInterface{ /** *Constructor that calls the super. *Create and export a new UnicastRemoteObject object using an anonymous port. */ PopupServerImpl() throws RemoteException { super(); } Vector v= new Vector(); // Vector to hold the references to the individual clients /** *Method to add a user on the server. *Basically regiseters a client with the server *@param userId, the remote interface representing the client object */ public void addUser(PopupClientInterface userId) throws RemoteException{ v.addElement(userId); } /** *Method to remove a registerd user onthe server. *Called by the client in its destroy before going down. *@param userId, the remote interface representing the client object */ public void removeUser(PopupClientInterface userId) throws RemoteException { v.removeElement(userId); } /** *Returns a listing of all the registerd users at any point of time. *@return The vector containing all the references to the clients */ public Vector getUsers() throws RemoteException { v.trimToSize(); return v; } /** *Sends a message to all the registerd clients. *@param String containing the message to be brodcast. */ public void sendMessage(String message) throws RemoteException { v.trimToSize(); for ( int i=0; i