53
|
1 package fdl.test.transfer.two;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.nio.ByteBuffer;
|
|
5
|
|
6 import fdl.FederatedLinda;
|
|
7 import fdl.PSXLinda;
|
|
8 import fdl.PSXReply;
|
|
9
|
|
10
|
|
11 public class TestGet extends Thread {
|
63
|
12 private static PSXLinda psxget;
|
|
13 private static FederatedLinda fdlget;
|
|
14 private static int port = 10001;
|
|
15 static String host = "127.0.0.1";
|
|
16 private static ByteBuffer data = ByteBuffer.allocate(1024);
|
53
|
17
|
63
|
18 public static void main(String[] args){
|
53
|
19 int id = 10;
|
|
20 int i;
|
|
21 fdlget = FederatedLinda.init();
|
|
22 try {
|
|
23 System.out.println("TestGet Start");
|
|
24 psxget = fdlget.open(host, port);
|
|
25 System.out.println("Host1 connected");
|
|
26 //getにidのタプルを取り出す
|
|
27 PSXReply dataGet = psxget.in(id);
|
|
28 System.out.println("dataget");
|
|
29 System.out.println(dataGet.ready());
|
|
30 if(dataGet.ready()){
|
|
31 System.out.println(dataGet);
|
|
32 data = dataGet.getData();
|
|
33 fdlget.sync(1);
|
|
34 i = data.getInt();
|
|
35 System.out.println(i);
|
|
36 }
|
|
37 } catch (IOException e) {
|
|
38 try {
|
|
39 Thread.sleep(10);
|
|
40 } catch (InterruptedException e1) {
|
|
41 }
|
|
42 }
|
|
43 }
|
|
44 }
|