22
|
1 package fdl.test;
|
|
2
|
|
3 import fdl.FDLindaServ;
|
|
4 import fdl.FederatedLinda;
|
|
5
|
|
6 public class TestLindaServer {
|
|
7 public FederatedLinda fdl;
|
|
8 public FDLindaServ fds;
|
|
9 public static final int PORT = 10000;
|
|
10
|
|
11 class Server implements Runnable {
|
|
12 public void run() {
|
|
13 String[] args = {"-p",Integer.toString(PORT)};
|
|
14 FDLindaServ.main(args);
|
|
15 }
|
|
16 }
|
|
17
|
|
18 class Client implements Runnable {
|
|
19 public void run() {
|
|
20 String[] args = {};
|
|
21 sleep(2000);
|
|
22 TestPSXLinda.main(args);
|
|
23 }
|
|
24 public synchronized void sleep(int time) {
|
|
25 try {
|
|
26 wait(time);
|
|
27 } catch (InterruptedException e) {
|
|
28 e.printStackTrace();
|
|
29 }
|
|
30 }
|
|
31 }
|
|
32
|
|
33 public static void main(String[] arg) {
|
|
34 TestLindaServer me = new TestLindaServer();
|
|
35 me.test1();
|
|
36 }
|
|
37
|
|
38 public void test1() {
|
|
39 Server s = new Server();
|
|
40 Client c = new Client();
|
|
41 new Thread(s).start();
|
|
42 new Thread(c).start();
|
|
43 }
|
|
44
|
|
45
|
|
46 }
|