Mercurial > hg > Members > tatsuki > Alice
view src/alice/test/topology/ring/CheckMyName.java @ 32:2bfb796b0fa1
change method to create DataSegmentReceiver
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 17 Jan 2012 20:49:26 +0900 |
parents | b5a21baf0b07 |
children | 20c67f673224 |
line wrap: on
line source
package alice.test.topology.ring; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegmentReceiver; public class CheckMyName extends CodeSegment { DataSegmentReceiver host = ids.createReceiver(CommandType.PEEK); @Override public void run() { String host = this.host.asString(); if (host.equals("node0")) { System.out.println("I am first node"); ods.put("local", "counter", 0); FirstRingMessagePassing cs1 = new FirstRingMessagePassing(); cs1.counter.setKey("local", "counter"); RingFinish cs2 = new RingFinish("manager"); cs2.finish.setKey("local", "finish"); } else { System.out.println("I am normal node"); RingMessagePassing cs1 = new RingMessagePassing(); cs1.counter.setKey("local", "counter"); RingFinish cs2 = new RingFinish("right"); cs2.finish.setKey("local", "finish"); } } }