view src/alice/test/topology/ring/RingMessagePassing.java @ 33:20c67f673224

change name of DataSegmentReceiver
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Wed, 18 Jan 2012 01:34:23 +0900
parents 2bfb796b0fa1
children ca079a730d0b
line wrap: on
line source

package alice.test.topology.ring;

import java.net.InetAddress;
import java.net.UnknownHostException;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;

public class RingMessagePassing extends CodeSegment {

	public 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);
		
		RingMessagePassing cs = new RingMessagePassing();
		cs.counter.setKey("local", "counter");
	}

}