annotate src/fdl/test/transfer/two/TestGet.java @ 66:82a292aa41ad

fix
author one
date Sat, 06 Jun 2009 14:23:02 +0900
parents b342dc9b52eb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
1 package fdl.test.transfer.two;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
2
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
3 import java.io.IOException;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
4 import java.nio.ByteBuffer;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
5
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
6 import fdl.FederatedLinda;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
7 import fdl.PSXLinda;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
8 import fdl.PSXReply;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
9
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
10
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
11 public class TestGet extends Thread {
63
b342dc9b52eb add document
axmo
parents: 53
diff changeset
12 private static PSXLinda psxget;
b342dc9b52eb add document
axmo
parents: 53
diff changeset
13 private static FederatedLinda fdlget;
b342dc9b52eb add document
axmo
parents: 53
diff changeset
14 private static int port = 10001;
b342dc9b52eb add document
axmo
parents: 53
diff changeset
15 static String host = "127.0.0.1";
b342dc9b52eb add document
axmo
parents: 53
diff changeset
16 private static ByteBuffer data = ByteBuffer.allocate(1024);
53
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
17
63
b342dc9b52eb add document
axmo
parents: 53
diff changeset
18 public static void main(String[] args){
53
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
19 int id = 10;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
20 int i;
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
21 fdlget = FederatedLinda.init();
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
22 try {
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
23 System.out.println("TestGet Start");
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
24 psxget = fdlget.open(host, port);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
25 System.out.println("Host1 connected");
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
26 //getにidのタプルを取り出す
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
27 PSXReply dataGet = psxget.in(id);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
28 System.out.println("dataget");
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
29 System.out.println(dataGet.ready());
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
30 if(dataGet.ready()){
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
31 System.out.println(dataGet);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
32 data = dataGet.getData();
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
33 fdlget.sync(1);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
34 i = data.getInt();
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
35 System.out.println(i);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
36 }
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
37 } catch (IOException e) {
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
38 try {
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
39 Thread.sleep(10);
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
40 } catch (InterruptedException e1) {
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
41 }
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
42 }
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
43 }
629b6cfbd37f metaprotocol ring
axmo
parents:
diff changeset
44 }