53
|
1 package fdl.test2;
|
|
2
|
66
|
3 import java.io.BufferedReader;
|
|
4 import java.io.FileReader;
|
53
|
5 import java.io.IOException;
|
|
6 import java.nio.ByteBuffer;
|
|
7
|
|
8 import fdl.FederatedLinda;
|
|
9 import fdl.PSXLinda;
|
|
10 import fdl.PSXReply;
|
|
11
|
|
12 public class TestRing {
|
|
13 static int id;
|
|
14 public static void main(String args[]){
|
|
15
|
|
16 try{
|
|
17 FederatedLinda fdl;
|
|
18 PSXLinda psx;
|
|
19 String host = "127.0.0.1";
|
|
20 PSXReply r;
|
|
21
|
|
22 FileReader in = new FileReader("nodelist");
|
|
23 BufferedReader br = new BufferedReader(in);
|
|
24 String line;
|
|
25
|
|
26 while ((line = br.readLine()) != null) {
|
|
27 int i1 = Integer.parseInt(line);
|
|
28 fdl = FederatedLinda.init();
|
|
29 psx = fdl.open(host,i1);
|
|
30 r = psx.in(65535);
|
|
31 fdl.sync(1);
|
|
32
|
|
33 ByteBuffer data = ByteBuffer.allocate(10);
|
|
34 data.putInt(10);
|
|
35 data.flip();
|
|
36
|
|
37 psx.out(1,data);
|
|
38 while(!r.ready()){
|
97
|
39 psx.sync(0);
|
53
|
40 }
|
|
41 }
|
|
42 br.close();
|
|
43 in.close();
|
|
44
|
|
45
|
|
46 }catch (IOException e) {
|
|
47 System.err.println("Communication failure.");
|
|
48 }
|
|
49
|
|
50 }
|
|
51 }
|