Mercurial > hg > Members > tatsuki > Alice
view 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 |
line wrap: on
line source
package alice.test.topology.ring; import org.apache.log4j.Logger; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class CheckMyName extends CodeSegment { public Receiver host = ids.create(CommandType.PEEK); private Logger logger = Logger.getLogger(CheckMyName.class); private RingTopologyConfig conf; public CheckMyName(RingTopologyConfig conf) { this.conf = conf; } @Override public void run() { String host = this.host.asString(); logger.debug(host); if (host.equals("node0")) { ods.put("local", "counter", new byte[conf.size]); FirstRingMessagePassing cs1 = new FirstRingMessagePassing(System.nanoTime(), conf.count, conf.nodeNum); cs1.counter.setKey("counter"); RingFinish cs2 = new RingFinish("manager"); cs2.finish.setKey("finish"); } else { ods.close("manager"); RingMessagePassing cs1 = new RingMessagePassing(); cs1.counter.setKey("counter"); RingFinish cs2 = new RingFinish("right"); cs2.finish.setKey("finish"); } } }