diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-22 08:12:17 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-22 08:12:17 +0000 |
commit | 67f2dc887d1d856ee7f190429a65bb9b564ebaef (patch) | |
tree | 8ee92803b2250d2ccb759dec0c3de7a49b6c6178 /java/apps/NexusII/src/Room.java | |
parent | 73b09290e29188937507b0fa68e29bbe2100d626 (diff) | |
download | ATCD-ACE-4_5_41.tar.gz |
This commit was manufactured by cvs2svn to create tag 'ACE-4_5_41'.ACE-4_5_41
Diffstat (limited to 'java/apps/NexusII/src/Room.java')
-rw-r--r-- | java/apps/NexusII/src/Room.java | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/java/apps/NexusII/src/Room.java b/java/apps/NexusII/src/Room.java deleted file mode 100644 index 4a9a294c653..00000000000 --- a/java/apps/NexusII/src/Room.java +++ /dev/null @@ -1,97 +0,0 @@ -// RoomThread and Room implement the concept of a chat "room" -// Sumedh Mungee <sumedh@cs.wustl.edu> - - -import java.util.*; -import java.io.File; - -// This class(&thread) is responsible for multicasting -// packets on its incoming "client" queues, onto one or -// more outgoing queues, which are picked up by the client. -class RoomThread implements Runnable, consts { - - private MT_Bounded_Queue rq_; - private Vector clientlist_; - - public RoomThread(MT_Bounded_Queue rq, Vector clientlist) { - rq_ = rq; - clientlist_ = clientlist; - } - - public void run() { - for(;;) { - dataPacket d = (dataPacket) rq_.dq(); // Extract packet - Enumeration e = clientlist_.elements(); // Iterate over clients - while(e.hasMoreElements()) - ((ClientHandler)e.nextElement()).getQ().nq(d); // Enqueue packet - } - } -} - - -public class Room implements consts { - - private String name_; // name of this "room" - private String last_image_ = new String("NexusII.gif"); // filename of the last image broadcast - private Thread roomthread_; - private MT_Bounded_Queue rq_ = new MT_Bounded_Queue(); - private Vector clientlist_ = new Vector(); - - // Constructors - public Room(String name) { - int i; - name_ = new String(name); - roomthread_ = new Thread(new RoomThread(rq_, clientlist_)); - roomthread_.start(); - } - - // Client management methods follow.. - - public synchronized void addClient(ClientHandler client) { - clientlist_.addElement(client); - } - // Returns true if this room has now become empty - public synchronized boolean delClient(ClientHandler client) { - clientlist_.removeElement(client); - return clientlist_.isEmpty(); - } - - public synchronized boolean checkClient(ClientHandler client) { - return clientlist_.contains(client); - } - - public synchronized Enumeration clientList() { - return clientlist_.elements(); - } - - public String getName() { - return name_; - } - - public MT_Bounded_Queue getQ() { - return rq_; - } - - public synchronized String getLastImageName() { - return last_image_; - } - - public synchronized void putNextImageName(String s) { - last_image_ = s; - } - - protected void finalize() { - roomthread_.stop(); - File f = new File(last_image_); - if(f.exists()) - f.delete(); - roomthread_ = null; - } -} - - - - - - - |