Mercurial > hg > Database > Christie
changeset 80:1e66fd626aff
fix localTestTopology code
author | akahori |
---|---|
date | Tue, 11 Sep 2018 18:20:59 +0900 |
parents | 0a724c973fc9 |
children | 41902f08efa7 |
files | src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java src/main/java/christie/test/topology/localTestTopology/StartLTCodeGear.java src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java |
diffstat | 3 files changed, 15 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Wed Sep 05 10:47:04 2018 +0900 +++ b/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Tue Sep 11 18:20:59 2018 +0900 @@ -8,26 +8,28 @@ import java.util.ArrayList; public class LTRemoteIncrement extends CodeGear { - - private final LocalTestTopologyConfig conf; + @Peek + String nodeName; @Take int num; - @Peek - ArrayList<String> _CLIST; - public LTRemoteIncrement(LocalTestTopologyConfig conf) { - this.conf = conf; + public LTRemoteIncrement() { } @Override protected void run(CodeGearManager cgm) { - System.out.println("node: " + conf.key + " num = " + num); - num++; - for( String node : _CLIST) { - getDGM(node).put("num", num ++); + System.out.println("node: " + nodeName + " num = " + num); + + if (num == 3) { + System.out.println("finish"); + } else { + num++; + getDGM("right").put("num", num); + cgm.setup(new LTRemoteIncrement()); } + } } \ No newline at end of file
--- a/src/main/java/christie/test/topology/localTestTopology/StartLTCodeGear.java Wed Sep 05 10:47:04 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -package christie.test.topology.localTestTopology; - -import christie.annotation.Peek; -import christie.annotation.Take; -import christie.codegear.CodeGear; -import christie.codegear.CodeGearManager; - -public class StartLTCodeGear extends CodeGear{ - - @Take - boolean running; - - @Override - protected void run(CodeGearManager cgm){ - if(running) cgm.getDGM("node1").put("num", 0); - else { - cgm.setup(new StartLTCodeGear()); - getLocalDGM().put("running", running); - } - } -}
--- a/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java Wed Sep 05 10:47:04 2018 +0900 +++ b/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java Tue Sep 11 18:20:59 2018 +0900 @@ -34,9 +34,10 @@ "--managerHost", "localhost"}; TopologyNodeConfig cs = new TopologyNodeConfig(nodeArg); - new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf)); + new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement()); + nodeCGM.getLocalDGM().put("num", 0); + } - topologyManagerCGM.setup(new StartLTCodeGear()); } }