diff src/main/java/alice/test/topology/share/AutoIncrement.java @ 345:8f71c3e6f11d

Change directory structure Maven standard
author sugi
date Wed, 16 Apr 2014 18:26:07 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/share/AutoIncrement.java	Wed Apr 16 18:26:07 2014 +0900
@@ -0,0 +1,28 @@
+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);	
+		
+	public AutoIncrement(String key,int index){
+		this.position.setKey(key, index);
+	}
+
+	@Override
+	public void run() {
+		synchronized(this){
+			try {
+				wait(50);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+		}
+		ods.update(position.key, new DataInfo(System.nanoTime()));
+		new AutoIncrement(position.key ,position.index);
+	}
+	
+}