345
|
1 package alice.test.topology.ring;
|
|
2
|
|
3 import org.apache.log4j.Logger;
|
|
4
|
|
5 import alice.codesegment.CodeSegment;
|
|
6 import alice.datasegment.CommandType;
|
|
7 import alice.datasegment.Receiver;
|
|
8
|
|
9 public class CheckMyName extends CodeSegment {
|
|
10
|
419
|
11 public Receiver ds1 = ids.create(CommandType.PEEK);
|
|
12
|
|
13 private Logger logger = Logger.getLogger(CheckMyName.class);
|
|
14 private RingTopologyConfig conf;
|
|
15
|
|
16 public CheckMyName(RingTopologyConfig conf) {
|
|
17 this.conf = conf;
|
|
18 }
|
|
19
|
|
20 @Override
|
|
21 public void run() {
|
|
22 String host = this.ds1.asString();
|
|
23 logger.debug(host);
|
|
24 if (host.equals("node0")) {
|
|
25 ods.put("local", "c", new byte[conf.size]);
|
|
26 FirstRingMessagePassing cs1 = new FirstRingMessagePassing(conf.count, conf.nodeNum);
|
|
27 cs1.ds1.setKey("c");
|
|
28 RingFinish cs2 = new RingFinish("manager");
|
|
29 cs2.finish.setKey("finish");
|
|
30 } else {
|
|
31 ods.close("manager");
|
|
32 RingMessagePassing cs1 = new RingMessagePassing();
|
|
33 cs1.ds1.setKey("c");
|
|
34 RingFinish cs2 = new RingFinish("right");
|
|
35 cs2.finish.setKey("finish");
|
|
36 }
|
|
37 }
|
345
|
38
|
|
39 }
|