# HG changeset patch # User akahori # Date 1546941634 -32400 # Node ID 37b28ffbab2f5fe5af990d6eed770ceb8100f108 # Parent e60ee525841d3d9a4a2d54b142677e3d5464c315 fix files diff -r e60ee525841d -r 37b28ffbab2f src/main/java/christie/topology/manager/ConfigWaiter.java.orig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/topology/manager/ConfigWaiter.java.orig Tue Jan 08 19:00:34 2019 +0900 @@ -0,0 +1,41 @@ +package christie.topology.manager; + + +import christie.annotation.Peek; +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + + +import java.util.LinkedList; + +public class ConfigWaiter extends CodeGear { + + @Peek + LinkedList waiterNodeNames; + + @Take + String nodePrepareDone; + + @Take + int nodeNum; + + public ConfigWaiter() { } + + @Override + protected void run(CodeGearManager cgm) { + nodeNum--; + if (nodeNum == 0) { + getLocalDGM().put("start", "start"); + for (String nodeName: waiterNodeNames) getDGM(nodeName).put("start", "start"); + getLocalDGM().put("startTime", System.currentTimeMillis()); + getLocalDGM().put("running", true); + + return; + } + + cgm.setup(new ConfigWaiter()); + getLocalDGM().put("nodeNum", nodeNum); + } + +} diff -r e60ee525841d -r 37b28ffbab2f src/test/java/christie/example/HelloWorld/HelloWorldCodeGear.java.orig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/HelloWorld/HelloWorldCodeGear.java.orig Tue Jan 08 19:00:34 2019 +0900 @@ -0,0 +1,18 @@ +package christie.example.HelloWorld; + +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + +public class HelloWorldCodeGear extends CodeGear { + + @Take + String helloWorld; + + @Override + protected void run(CodeGearManager cgm) { + System.out.print(helloWorld + " "); + if(helloWorld.equals("world")) return; + cgm.setup(new HelloWorldCodeGear()); + } +}