annotate src/fdl/old/test/metaTransfer/TestSend.java @ 114:3b877c9a44f5

gather old packages
author kazz
date Mon, 11 Oct 2010 14:29:37 +0900
parents src/fdl/test/metaTransfer/TestSend.java@629b6cfbd37f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
114
3b877c9a44f5 gather old packages
kazz
parents: 53
diff changeset
1 package fdl.old.test.metaTransfer;
52
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
2
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
3 import java.io.IOException;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
4 import java.nio.ByteBuffer;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
5
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
6 import fdl.FederatedLinda;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
7 import fdl.PSXLinda;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
8
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
9 public class TestSend extends Thread {
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
10 PSXLinda psxsend;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
11 FederatedLinda fdlsend;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
12
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
13 public void run(){
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
14 int id = 10;
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
15 int port = 10001;
53
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
16 boolean connect = true;
52
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
17 String host = "127.0.0.1";
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
18 ByteBuffer send = ByteBuffer.allocate(1024);
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
19 send.putInt(12);
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
20 send.flip();
53
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
21 while(connect){
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
22 try {
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
23 sendData(id, port, host, send);
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
24 connect = false;
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
25 } catch(IOException e) {
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
26 try {
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
27 Thread.sleep(40);
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
28 } catch (InterruptedException e1) {
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
29 e1.printStackTrace();
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
30 }
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
31 }
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
32
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
33 }
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
34 }
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
35
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
36 private void sendData(int id, int port, String host, ByteBuffer send) throws IOException {
52
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
37 fdlsend = FederatedLinda.init();
53
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
38
52
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
39 psxsend = fdlsend.open(host,port);
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
40 System.out.println("Connect Host1");
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
41 psxsend.out(id, send);
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
42 fdlsend.sync(1);
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
43 System.out.println("Send Data");
53
629b6cfbd37f metaprotocol ring
axmo
parents: 52
diff changeset
44
52
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
45 }
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
46
00d2203fac80 MetaProtocolEngine still
axmo
parents:
diff changeset
47 }