8 import java.rmi.server.*;
12 Vector <LineCoords> vLines;
13 Vector <WbClient> vClients;
15 public ABoard(String brdnm) {
17 vLines =
new Vector <LineCoords> ();
18 vClients =
new Vector <WbClient> ();
23 extends UnicastRemoteObject
31 vBoards =
new Vector <ABoard> ();
32 myURL = Invoke.makeURL(
'S', args[0]);
33 Naming.rebind(
myURL,
this);
34 Invoke.myPrint(
"WbServerImpl", myURL +
" started");
39 Timer timer =
new Timer();
40 timer.schedule(
new TimerTask(){
42 try {Naming.unbind(
myURL);}
43 catch (Exception e) {e.printStackTrace();}
44 Invoke.myPrint(
"WbServerImpl",
myURL +
" exits");
51 for (Enumeration e =
vBoards.elements(); e.hasMoreElements();) {
52 ABoard b = (ABoard) e.nextElement();
53 if (brdnm.equals(b.boardName))
60 throws java.rmi.RemoteException {
66 for (Enumeration e = ab.vLines.elements(); e.hasMoreElements(); ) {
67 try {wc.updateBoard((
LineCoords) e.nextElement());}
68 catch (Exception x) {x.printStackTrace();}
73 throws java.rmi.RemoteException {
76 ab =
new ABoard(brdnm);
77 vBoards.addElement(ab);
81 ab.vClients.addElement(wc);
85 throws java.rmi.RemoteException {
87 if (ab == null)
return;
89 ab.vClients.removeElement(wc);
92 if (ab.vClients.size() == 0)
vBoards.removeElement(ab);
99 throws java.rmi.RemoteException {
101 if (ab == null)
return;
103 ab.vLines.addElement(ln);
106 for (Enumeration e = ab.vClients.elements(); e.hasMoreElements();) {
108 try {wc.updateBoard(ln);}
109 catch (Exception x) {x.printStackTrace();}
113 public static void main(String args[]) {
115 catch (Exception e) {e.printStackTrace();}
void addLine(LineCoords ln, String brdnm)
void sendAllLines(WbClient wc, String brdnm)
ABoard findAboard(String brdnm)
static void main(String args[])
WbServerImpl(String[] args)
void delClient(WbClient wc, String brdnm)
void sendAllLines(WbClient wc, ABoard ab)
void addClient(WbClient wc, String brdnm)