view src/alice/test/topology/share/AutoIncrement.java @ 182:52a1fa5ba38b working

add filp api
author e095732
date Tue, 26 Feb 2013 13:46:18 +0900
parents ae6ed9c35288
children b5daccf36104
line wrap: on
line source

package alice.test.topology.share;

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

public class AutoIncrement extends CodeSegment {
	
	public Receiver position = ids.create(CommandType.PEEK);	
	String key;
		
	public AutoIncrement(String key,int index){
		this.key = key;
		this.position.setKey("local", key, index);
	}

	@Override
	public void run() {
		synchronized(this){
			try {
				wait(50);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		ods.update("local", key, new DataInfo(System.nanoTime()));
		new AutoIncrement(this.key ,this.position.index);
	}
	
}