KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > web > oamp > plugin > OAMPClientList


1 /*
2  * OAMPClientList.java
3  *
4  * Created on June 2, 2002, 3:31 PM
5  */

6
7 package com.quikj.application.web.oamp.plugin;
8
9 import com.quikj.server.web.*;
10
11 import java.util.*;
12
13
14 /**
15  *
16  * @author amit
17  */

18 public class OAMPClientList
19 {
20     private OAMPClientList()
21     {
22         instance = this;
23     }
24     
25     public static OAMPClientList Instance()
26     {
27         if (instance == null)
28         {
29             new OAMPClientList();
30         }
31         
32         return instance;
33     }
34     
35     public synchronized void dispose()
36     {
37         clientList.clear();
38     }
39     
40     public synchronized void add(EndPointInterface endpoint, OAMPClient oampclient)
41     {
42         clientList.put(endpoint, oampclient);
43     }
44     
45     public synchronized void remove(EndPointInterface endpoint)
46     {
47         clientList.remove(endpoint);
48     }
49     
50     public synchronized OAMPClient[] getElements()
51     {
52         OAMPClient[] temp = new OAMPClient[clientList.size()];
53         return ((OAMPClient[]) (clientList.values().toArray(temp)));
54     }
55    
56
57     private Hashtable clientList = new Hashtable();
58     private static OAMPClientList instance = null;
59     
60 }
61
Popular Tags