Mercurial > hg > Database > Christie
changeset 129:2e2d761ea806
fix List Peek to Take
author | akahori |
---|---|
date | Tue, 25 Dec 2018 15:16:17 +0900 |
parents | 2886363f5e12 |
children | b94aef33e262 |
files | src/main/java/christie/topology/manager/CreateTreeTopology.java src/main/java/christie/topology/manager/IncomingHosts.java src/main/java/christie/topology/manager/RecordTopology.java src/main/java/christie/topology/node/CreateConnectionList.java src/main/java/christie/topology/node/PrepareToClose.java |
diffstat | 5 files changed, 31 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/topology/manager/CreateTreeTopology.java Tue Dec 25 15:13:59 2018 +0900 +++ b/src/main/java/christie/topology/manager/CreateTreeTopology.java Tue Dec 25 15:16:17 2018 +0900 @@ -17,16 +17,16 @@ @Take int hostCount; - @Peek + @Take HashMap<String, HostMessage> nameTable; @Take String MD5; - @Peek + @Take HashMap<String, String> absCookieTable; - @Peek + @Take ParentManager parentManager; public CreateTreeTopology(){ @@ -46,8 +46,9 @@ getDGM(nodeName).put("cookie", MD5); absCookieTable.put(MD5, nodeName); + getLocalDGM().put("absCookieTable", absCookieTable); + getLocalDGM().put("hostCount", hostCount + 1); - newHost.setAlive(true); nameTable.put(nodeName, newHost); parentManager.register(nodeName); @@ -63,10 +64,12 @@ getDGM(nodeName).put("connectNodeNum", 1); // put parent information own String parentNodeName = parentManager.getMyParent(); - HostMessage parentHost = nameTable.get(parentNodeName); + HostMessage parentHost = nameTable.get(parentNodeName).clone(); + // 相手からhostNameとportはもらっているので, nodeの情報だけ与えれば良い. parentHost.setNodeInfo(nodeName, "parent", parentNodeName); + //parentHost.setNodeInfo(parentNodeName, "child", nodeName); getLocalDGM().put("nodeInfo", parentHost); cgm.setup(new RecordTopology()); @@ -76,6 +79,9 @@ cgm.setup(new RecordTopology()); } + getLocalDGM().put("nameTable", nameTable); + getLocalDGM().put("parentManager", parentManager); + getDGM(nodeName).put("start", "start"); getLocalDGM().put("startTime", System.currentTimeMillis());
--- a/src/main/java/christie/topology/manager/IncomingHosts.java Tue Dec 25 15:13:59 2018 +0900 +++ b/src/main/java/christie/topology/manager/IncomingHosts.java Tue Dec 25 15:16:17 2018 +0900 @@ -12,11 +12,11 @@ public class IncomingHosts extends CodeGear { - @Peek // Topology from parse file + @Take HashMap<String, LinkedList<HostMessage>> resultParse; - @Peek // nodeName list + @Take LinkedList<String> nodeNames; - @Peek + @Take HashMap<String, String> absCookieTable; @Take // new coming host info @@ -32,6 +32,7 @@ protected void run(CodeGearManager cgm) { // not have or match cookie String nodeName = nodeNames.poll(); + getLocalDGM().put("nodeNames", nodeNames); String newHostName = newHost.getHostName(); int newHostPort = newHost.getPort(); @@ -40,6 +41,7 @@ cgm.createRemoteDGM(nodeName, newHostName, newHostPort); absCookieTable.put(MD5, nodeName); + getLocalDGM().put("absCookieTable", absCookieTable); getDGM(nodeName).put( "nodeName", nodeName); getDGM(nodeName).put("cookie", MD5); @@ -53,6 +55,8 @@ cgm.setup(new RecordTopology()); } + getLocalDGM().put("resultParse", resultParse); + cgm.setup(new IncomingHosts()); } }
--- a/src/main/java/christie/topology/manager/RecordTopology.java Tue Dec 25 15:13:59 2018 +0900 +++ b/src/main/java/christie/topology/manager/RecordTopology.java Tue Dec 25 15:16:17 2018 +0900 @@ -16,7 +16,7 @@ @Take HostMessage nodeInfo; - @Peek + @Take HashMap<String, HashMap<String, HostMessage>> topology; // ノード数nの全結合のデータ数 (n-1)*n + n @Override @@ -43,6 +43,10 @@ } } } + + getLocalDGM().put("topology", topology); + + } }
--- a/src/main/java/christie/topology/node/CreateConnectionList.java Tue Dec 25 15:13:59 2018 +0900 +++ b/src/main/java/christie/topology/node/CreateConnectionList.java Tue Dec 25 15:16:17 2018 +0900 @@ -8,7 +8,7 @@ import java.util.List; public class CreateConnectionList extends CodeGear { - @Peek + @Take List<String> _CLIST; @Take String cMember; @@ -19,6 +19,7 @@ protected void run(CodeGearManager cgm) { _CLIST.add(cMember); + getLocalDGM().put("_CLIST", _CLIST); } }
--- a/src/main/java/christie/topology/node/PrepareToClose.java Tue Dec 25 15:13:59 2018 +0900 +++ b/src/main/java/christie/topology/node/PrepareToClose.java Tue Dec 25 15:16:17 2018 +0900 @@ -11,8 +11,8 @@ public class PrepareToClose extends CodeGear { - @Peek - String _CLOSEMESSEAGE; + @Take + String _CLOSEMESSAGE; @Peek List<String> _CLIST; @@ -29,9 +29,12 @@ protected void run(CodeGearManager cgm) { for(String dgmName: _CLIST){ getDGM(dgmName).shutdown(); + } - getLocalDGM().finish(); + if(_CLIST.isEmpty()) { + getLocalDGM().finish(); + } /*if (_CLIST.contains(_CLOSEMESSEAGE)) { _CLIST.remove(_CLOSEMESSEAGE);