Mercurial > hg > Database > Christie
changeset 127:42f195de3152
fix topologyManager
author | akahori |
---|---|
date | Tue, 18 Dec 2018 15:14:45 +0900 |
parents | c6e4d0e4954c |
children | 2886363f5e12 |
files | src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java src/main/java/christie/topology/manager/TopologyFinish.java src/main/java/christie/topology/node/ConfigurationFinish.java src/main/java/christie/topology/node/IncomingReverseKey.java src/main/java/christie/topology/node/PrepareToClose.java src/main/java/christie/topology/node/TopologyNode.java |
diffstat | 6 files changed, 35 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Tue Dec 18 15:12:45 2018 +0900 +++ b/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Tue Dec 18 15:14:45 2018 +0900 @@ -25,7 +25,6 @@ if (num == 3) { getDGM(topologyNodeConfig.getManagerKey()).put("finish", ""); - getLocalDGM().finish(); } else { num++; getDGM("right").put("num", num);
--- a/src/main/java/christie/topology/manager/TopologyFinish.java Tue Dec 18 15:12:45 2018 +0900 +++ b/src/main/java/christie/topology/manager/TopologyFinish.java Tue Dec 18 15:14:45 2018 +0900 @@ -7,7 +7,6 @@ public class TopologyFinish extends CodeGear { - @Take String finish; @@ -19,11 +18,18 @@ @Override protected void run(CodeGearManager cgm) { + if (topologyManagerConfig.showTime) { + System.out.println("TopologymanagerTime = " + (System.currentTimeMillis() - startTime)); + } - if (topologyManagerConfig.showTime) { - System.out.println("TopologymanagerTime = "+ (System.currentTimeMillis()-startTime)); + + for(String dgm : cgm.getDGMList().keySet()){ + getDGM(dgm).put("_CLOSEMESSEAGE", "_CLOSEMESSEAGE"); + getDGM(dgm).shutdown(); } - System.exit(0); + + getLocalDGM().finish(); + } }
--- a/src/main/java/christie/topology/node/ConfigurationFinish.java Tue Dec 18 15:12:45 2018 +0900 +++ b/src/main/java/christie/topology/node/ConfigurationFinish.java Tue Dec 18 15:14:45 2018 +0900 @@ -31,10 +31,13 @@ /*if (topologyNodeConfig.useKeepAlive) - cgm.setup(new KeepAlive()); + cgm.setup(new KeepAlive());*/ cgm.setup(new PrepareToClose()); - ClosedEventManager.getInstance().register(DeleteConnection.class); - ClosedEventManager.getInstance().setKey();*/ + + /*ClosedEventManager closedEventManager = new ClosedEventManager(); + closedEventManager.register(cgm, DeleteConnection.class); + cgm.setup(closedEventManager); + return;*/ }else { getLocalDGM().put("reverseCount", reverseCount);
--- a/src/main/java/christie/topology/node/IncomingReverseKey.java Tue Dec 18 15:12:45 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -package christie.topology.node; - - -import christie.annotation.Take; -import christie.codegear.CodeGear; -import christie.codegear.CodeGearManager; - - -// pingを受け取るみたいなクラス. 相手がreverseNodeNameを送ってきたらreverseCountをプラスする -public class IncomingReverseKey extends CodeGear { - - @Take - String reverseNodeName; - - @Take - int reverseCount; - - @Override - protected void run(CodeGearManager cgm) { - reverseCount++; - getLocalDGM().put( "reverseCount", reverseCount); - cgm.setup(new IncomingReverseKey()); - } - -}
--- a/src/main/java/christie/topology/node/PrepareToClose.java Tue Dec 18 15:12:45 2018 +0900 +++ b/src/main/java/christie/topology/node/PrepareToClose.java Tue Dec 18 15:14:45 2018 +0900 @@ -5,6 +5,7 @@ import christie.annotation.Take; import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; +import christie.datagear.DataGearManager; import java.util.List; @@ -16,6 +17,9 @@ @Peek List<String> _CLIST; + @Peek + TopologyNodeConfig topologyNodeConfig; + public PrepareToClose() { @@ -23,23 +27,25 @@ @Override protected void run(CodeGearManager cgm) { - /* - if (_CLIST.contains(_CLOSEMESSEAGE)) { + for(String dgmName: _CLIST){ + getDGM(dgmName).shutdown(); + } + + getLocalDGM().finish(); + + /*if (_CLIST.contains(_CLOSEMESSEAGE)) { _CLIST.remove(_CLOSEMESSEAGE); - DataSegmentManager manager = DataSegment.get(_CLOSEMESSEAGE); - manager.setSendError(false); - - ods.put(_CLOSEMESSEAGE, "_CLOSEREADY", _CLOSEMESSEAGE); - ods.put("_CLOSEREADY", _CLOSEMESSEAGE); + getDGM(_CLOSEMESSEAGE).setSendError(false); + getDGM(_CLOSEMESSEAGE).close(); - new CloseRemoteDataSegment(); - } else { - // lost node is this node's parent, so already removed - new ReceiveCloseMessage(CommandType.TAKE); - }*/ + getDGM(_CLOSEMESSEAGE).put("_CLOSEREADY", _CLOSEMESSEAGE); + getLocalDGM().put("_CLOSEREADY", _CLOSEMESSEAGE); + + cgm.setup(new CloseRemoteDataGear()); + } cgm.setup(new PrepareToClose()); - //getLocalDGM().put("_CLIST", _CLIST); + getLocalDGM().put("_CLIST", _CLIST);*/ }
--- a/src/main/java/christie/topology/node/TopologyNode.java Tue Dec 18 15:12:45 2018 +0900 +++ b/src/main/java/christie/topology/node/TopologyNode.java Tue Dec 18 15:14:45 2018 +0900 @@ -34,7 +34,6 @@ getLocalDGM().put("reverseCount", 0); cgm.setup(new IncomingConnectionInfo()); - //cgm.setup(new IncomingReverseKey()); cgm.setup(new ConfigurationFinish()); }