view src/alice/test/topology/aquarium/CheckLocalIndex.java @ 303:6e0a909b4b12

add PingScheduler
author sugi
date Tue, 19 Nov 2013 14:04:57 +0900
parents 84b7eac2ff7d
children
line wrap: on
line source

package alice.test.topology.aquarium;

import java.util.List;

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

public class CheckLocalIndex extends CodeSegment {

	private Receiver data = ids.create(CommandType.PEEK);
	private Receiver list = ids.create(CommandType.PEEK);
	
	public CheckLocalIndex(String key, int index){
		this.list.setKey("_CLIST");
		this.data.setKey(key, index);
	}
	
	@Override
	public void run() {
		@SuppressWarnings("unchecked")
		List<String> r = list.asClass(List.class);
		for (String node : r) {
			if (!node.equals(data.from)) {
				System.out.println(data.from);
				ods.update(node, data.key, data.getVal());
			}
		}
		new CheckLocalIndex(data.key, data.index);
		
	}

}