view src/alice/test/topology/share/AutoIncrement.java @ 137:ed78890ed8e9 working

Share Test
author sugi
date Sun, 26 Aug 2012 18:33:13 +0900
parents
children ae6ed9c35288
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() {
		DataInfo info = this.position.asClass(DataInfo.class);
		info.setTime(System.currentTimeMillis());
		ods.update("local", key, info);
	}
	
}