Mercurial > hg > Members > tatsuki > Alice
view src/alice/test/topology/ring/FirstRingMessagePassing.java @ 39:3155337e754e
add logger
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 27 Jan 2012 16:57:26 +0900 |
parents | 20c67f673224 |
children | ae24d5d40c10 |
line wrap: on
line source
package alice.test.topology.ring; import java.net.InetAddress; import java.net.UnknownHostException; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class FirstRingMessagePassing extends CodeSegment { Receiver counter = ids.create(CommandType.TAKE); @Override public void run() { int counter = this.counter.asInteger(); try { System.out.print("[" + InetAddress.getLocalHost().getHostName() + "] "); } catch (UnknownHostException e) { e.printStackTrace(); } System.out.println(++counter); ods.put("right", "counter", counter); if (counter >= 10) { ods.put("right", "finish", ValueFactory.createNilValue()); return; } FirstRingMessagePassing cs = new FirstRingMessagePassing(); cs.counter.setKey("local", "counter"); } }