Mercurial > hg > FederatedLinda
comparison src/fdl/test/debug2/DebugStartCallback.java @ 92:ea4ee892baf5
commit
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 22 Apr 2010 16:13:03 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
91:4df1d50df52a | 92:ea4ee892baf5 |
---|---|
1 package fdl.test.debug2; | |
2 | |
3 import java.nio.ByteBuffer; | |
4 //import java.util.Date; | |
5 | |
6 import fdl.PSXCallback; | |
7 | |
8 class DebugStartCallback implements PSXCallback { | |
9 public NodeProperty np; | |
10 public DebugProperty dp; | |
11 public DebugStartCallback(NodeProperty np, DebugProperty dp) { | |
12 this.np = np; | |
13 this.dp = dp; | |
14 } | |
15 public void callback(ByteBuffer reply) { | |
16 String[] commands = new String(reply.array()).split(","); | |
17 String command = commands[0]; | |
18 if (command.equals("relay")) { | |
19 dp.relayNum = Integer.parseInt(commands[1]); | |
20 dp.relaySize = Integer.parseInt(commands[2]); | |
21 dp.relayCounter = 0; | |
22 Debug.print("relay num=" + dp.relayNum + " size=" + dp.relaySize); | |
23 Routing r = np.nodes.get(TupleId.RINGRIGHT); | |
24 // 実験開始 | |
25 // TODO: startTime? | |
26 //startTime = new Date(); | |
27 r.linda.out(r.dstId, ByteBuffer.wrap(new byte[dp.relaySize])); | |
28 np.ml.in(TupleId.DEBUGSTART.id, this); | |
29 } else if (command.equals("print")) { | |
30 Routing r = np.nodes.get(TupleId.RINGRIGHT); | |
31 r.linda.out(r.dstId, reply); | |
32 Debug.print("Send Debug Message: print"); | |
33 np.ml.in(TupleId.DEBUGSTART.id, this); | |
34 } else if (command.equals("shutdown")) { | |
35 Routing r = np.nodes.get(TupleId.RINGRIGHT); | |
36 r.linda.out(r.dstId, ByteBuffer.wrap("shutdown".getBytes())); | |
37 } | |
38 } | |
39 } |