Mercurial > hg > Database > Alice
diff src/main/java/alice/topology/manager/SearchHostName.java @ 432:59e84cd75403 dispose
SearchHostName has bug
author | sugi |
---|---|
date | Mon, 04 Aug 2014 20:34:41 +0900 |
parents | 1b32ea1263f3 |
children | e565d481c52e |
line wrap: on
line diff
--- a/src/main/java/alice/topology/manager/SearchHostName.java Mon Aug 04 08:40:28 2014 +0900 +++ b/src/main/java/alice/topology/manager/SearchHostName.java Mon Aug 04 20:34:41 2014 +0900 @@ -3,6 +3,8 @@ import java.util.HashMap; import java.util.LinkedList; +import org.msgpack.type.ValueFactory; + import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; @@ -13,15 +15,18 @@ private Receiver info = ids.create(CommandType.TAKE); // reconnect NodeInfo private Receiver info1 = ids.create(CommandType.TAKE); // topology recode (HashMap) + private Receiver info2 = ids.create(CommandType.PEEK); // check App running public SearchHostName(){ info.setKey("reconnect"); info1.setKey("topology"); + info2.setKey("running"); } @Override public void run() { HostMessage hostInfo = info.asClass(HostMessage.class); + boolean running = info2.asClass(boolean.class); @SuppressWarnings("unchecked") HashMap<String, LinkedList<HostMessage>> topology = info1.asClass(HashMap.class); @@ -32,9 +37,14 @@ // put Host dataSegment on reconnect node if (topology.containsKey(hostInfo.absName)) { LinkedList<HostMessage> clist = topology.get(hostInfo.absName); - for (HostMessage node : clist) - ods.put(hostInfo.absName, node); - + ods.put(hostInfo.absName, "dummy"); + if (running){ + ods.put(hostInfo.absName, ValueFactory.createNilValue()); + } + for (HostMessage node : clist){ + ods.put("local" ,hostInfo.absName, node); + System.out.println("put data in "+ hostInfo.absName); + } } // update topology information @@ -44,13 +54,11 @@ // find and update old info if (hostInfo.absName.equals(host.absName)){ if (!hostInfo.name.equals(host.name) || (hostInfo.port != host.port)){ - list.remove(host); - HostMessage newHost = new HostMessage(hostInfo.name, hostInfo.port, host.connectionName, host.reverseName); - newHost.absName = host.absName; - newHost.remoteAbsName = host.remoteAbsName; - - ods.put(host.remoteAbsName, newHost); - list.add(newHost); + host.name = hostInfo.name; + host.port = hostInfo.port; + + ods.put(host.remoteAbsName, host); + } else { // nothing to do ? }