Mercurial > hg > Database > Alice
view src/main/java/alice/test/topology/ring/CheckMyName.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children | aefbe41fcf12 |
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 ds1 = 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.ds1.asString(); logger.debug(host); if (host.equals("node0")) { ods.put("local", "c", new byte[conf.size]); FirstRingMessagePassing cs1 = new FirstRingMessagePassing(conf.count, conf.nodeNum); cs1.ds1.setKey("c"); RingFinish cs2 = new RingFinish("manager"); cs2.finish.setKey("finish"); } else { ods.close("manager"); RingMessagePassing cs1 = new RingMessagePassing(); cs1.ds1.setKey("c"); RingFinish cs2 = new RingFinish("right"); cs2.finish.setKey("finish"); } } }