view src/alice/test/topology/share/AutoIncrement.java @ 217:b5c642ba998e working

change as** method and remove "local" key in TEST
author sugi
date Wed, 27 Mar 2013 20:02:38 +0900
parents fec0726bb126
children 68f6e0fa4a89
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(key, index);
	}

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