comparison src/alice/test/topology/ring/CheckMyName.java @ 65:ca42a2c8ac22

add local access api
author kazz
date Thu, 09 Feb 2012 19:33:46 +0900
parents ead04b496305
children f2d4a4686036
comparison
equal deleted inserted replaced
64:7aaadd08288c 65:ca42a2c8ac22
10 10
11 public Receiver host = ids.create(CommandType.PEEK); 11 public Receiver host = ids.create(CommandType.PEEK);
12 12
13 private Logger logger = Logger.getLogger(CheckMyName.class); 13 private Logger logger = Logger.getLogger(CheckMyName.class);
14 private RingTopologyConfig conf; 14 private RingTopologyConfig conf;
15
15 public CheckMyName(RingTopologyConfig conf) { 16 public CheckMyName(RingTopologyConfig conf) {
16 this.conf = conf; 17 this.conf = conf;
17 } 18 }
19
18 @Override 20 @Override
19 public void run() { 21 public void run() {
20 String host = this.host.asString(); 22 String host = this.host.asString();
21 logger.debug(host); 23 logger.debug(host);
22 if (host.equals("node0")) { 24 if (host.equals("node0")) {
23 ods.put("local", "counter", new byte[conf.size]); 25 ods.put("local", "counter", new byte[conf.size]);
24 FirstRingMessagePassing cs1 = new FirstRingMessagePassing(System.nanoTime(), conf.count, conf.nodeNum); 26 FirstRingMessagePassing cs1 = new FirstRingMessagePassing(System.nanoTime(), conf.count, conf.nodeNum);
25 cs1.counter.setKey("local", "counter"); 27 cs1.counter.setKey("counter");
26 RingFinish cs2 = new RingFinish("manager"); 28 RingFinish cs2 = new RingFinish("manager");
27 cs2.finish.setKey("local", "finish"); 29 cs2.finish.setKey("finish");
28 } else { 30 } else {
29 ods.close("manager"); 31 ods.close("manager");
30 RingMessagePassing cs1 = new RingMessagePassing(); 32 RingMessagePassing cs1 = new RingMessagePassing();
31 cs1.counter.setKey("local", "counter"); 33 cs1.counter.setKey("counter");
32 RingFinish cs2 = new RingFinish("right"); 34 RingFinish cs2 = new RingFinish("right");
33 cs2.finish.setKey("local", "finish"); 35 cs2.finish.setKey("finish");
34 } 36 }
35 } 37 }
36 38
37 } 39 }