Mercurial > hg > Database > Alice
changeset 489:9a7dd7591ddc dispose
bug fix
author | sugi |
---|---|
date | Tue, 09 Dec 2014 14:25:57 +0900 |
parents | 7ef0ebb40c9b |
children | f28087efa911 |
files | src/main/java/alice/topology/fix/FixTopology.java src/main/java/alice/topology/manager/ParentManager.java src/main/java/alice/topology/manager/keeparive/ListManager.java src/main/java/alice/topology/manager/keeparive/TaskExecuter.java |
diffstat | 4 files changed, 37 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/topology/fix/FixTopology.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/fix/FixTopology.java Tue Dec 09 14:25:57 2014 +0900 @@ -8,6 +8,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.topology.HostMessage; +import alice.topology.manager.Parent; import alice.topology.manager.ParentManager; public class FixTopology extends CodeSegment { @@ -65,10 +66,7 @@ } if (!lastJoinNodeName.equals(lostNodeName)) { - - if (lostNodeName.equals(parentNode.remoteAbsName)) { - - } else { + if (!lostNodeName.equals(parentNode.remoteAbsName)) { // send close message to lastJoinedNode ods.put(lastJoinNodeName, "_CLOSEMESSEAGE", parentNode.reverseName); // send close message to lastJoinedNode's parent @@ -103,29 +101,34 @@ break; } } + } } disconnectionList.clear(); manager.replaceAndRemove(lostNodeName, lastJoinNodeName); } else { // disconnection node is lastJoinedNode + Parent p = manager.find(parentNode.absName); + p.decrement(); manager.remove(lostNodeName); } + + // need debug option + for (LinkedList<HostMessage> list :topology.values()){ + if (list.size() !=0) { + System.out.print(list.get(0).remoteAbsName+" : "); + for (HostMessage host : list){ + System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); + } + System.out.println(); + } + } + + manager.show(); } else { // disconnect message already received. } - // need debug option - for (LinkedList<HostMessage> list :topology.values()){ - if (list.size() !=0) { - System.out.print(list.get(0).remoteAbsName+" : "); - for (HostMessage host : list){ - System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); - } - System.out.println(); - } - } - ods.put(info1.key, topology); ods.put(info2.key, info2.getReceiveData()); ods.put(info3.key, nameTable);
--- a/src/main/java/alice/topology/manager/ParentManager.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/manager/ParentManager.java Tue Dec 09 14:25:57 2014 +0900 @@ -54,11 +54,7 @@ list.remove(removeNode); } - public void decrementChild(String name) { - list.get(position).decrement(); - } - - private Parent find(String name) { + public Parent find(String name) { boolean found = false; int i = 0; for (;i<list.size();i++) { @@ -73,4 +69,14 @@ return null; } } + + public void show() { + int counter = 0; + System.out.print("| "); + for (Parent p :list) { + if (counter==position) + System.out.print("P "); + System.out.print(p.getName()+" "+p.children()+" | "); + } + } }
--- a/src/main/java/alice/topology/manager/keeparive/ListManager.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/manager/keeparive/ListManager.java Tue Dec 09 14:25:57 2014 +0900 @@ -85,10 +85,13 @@ } public void deleteAll(String name) { - if (TaskExecuter.getInstance().getNowTask().getManagerKey() != null && - TaskExecuter.getInstance().getNowTask().getManagerKey().equals(name)) - TaskExecuter.getInstance().skip(); - TaskInfo task = new TaskInfo(TaskType.CLOSE); + TaskInfo task = TaskExecuter.getInstance().getNowTask(); + if (task!= null) { + if (task.getManagerKey() != null && task.getManagerKey().equals(name)) { + TaskExecuter.getInstance().skip(); + } + } + task = new TaskInfo(TaskType.CLOSE); task.setInfo(name, 0); while(deleteTask(task)); task = new TaskInfo(TaskType.PING);
--- a/src/main/java/alice/topology/manager/keeparive/TaskExecuter.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/manager/keeparive/TaskExecuter.java Tue Dec 09 14:25:57 2014 +0900 @@ -120,7 +120,7 @@ } } - public boolean compareNowTask(TaskInfo task) { + public synchronized boolean compareNowTask(TaskInfo task) { if (nowTask != null){ if (nowTask.getType().equals(task.getType()) && nowTask.getManagerKey().equals(task.getManagerKey())){