diff src/main/java/alice/test/topology/localTestTopology/LTRemoteIncrement.java @ 643:74dbb8809c73

add local topology test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 31 Dec 2017 09:51:24 +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/localTestTopology/LTRemoteIncrement.java	Sun Dec 31 09:51:24 2017 +0900
@@ -0,0 +1,33 @@
+package alice.test.topology.localTestTopology;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+import java.util.List;
+
+public class LTRemoteIncrement extends CodeSegment {
+
+    private final LocalTestTopologyConfig conf;
+    public Receiver num = ids.create(CommandType.TAKE);
+    public Receiver clist = ids.create(CommandType.TAKE);
+
+    public LTRemoteIncrement(LocalTestTopologyConfig conf) {
+        this.conf = conf;
+        num.setKey(conf.key,"num");
+        clist.setKey(conf.key,"_CLIST");
+    }
+
+    @Override
+    public void run() {
+        int num = this.num.asInteger();
+        System.out.println("node: " + conf.key + " num = " + num);
+        num++;
+        @SuppressWarnings("unchecked")
+        List<String> list = clist.asClass(List.class);
+        for( String node : list) {
+            ods.put(node, "num", num ++);
+        }
+    }
+
+}
\ No newline at end of file