changeset 432:59e84cd75403 dispose

SearchHostName has bug
author sugi
date Mon, 04 Aug 2014 20:34:41 +0900
parents 0239c1633012
children e565d481c52e
files src/main/java/alice/topology/manager/ConfigWaiter.java src/main/java/alice/topology/manager/SearchHostName.java src/main/java/alice/topology/manager/StartTopologyManager.java src/main/java/alice/topology/node/ConfigurationFinish.java src/main/java/alice/topology/node/IncomingConnectionInfo.java
diffstat 5 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/topology/manager/ConfigWaiter.java	Mon Aug 04 08:40:28 2014 +0900
+++ b/src/main/java/alice/topology/manager/ConfigWaiter.java	Mon Aug 04 20:34:41 2014 +0900
@@ -20,6 +20,7 @@
         count--;
         if (count == 0) {
             ods.put("local", "start", ValueFactory.createNilValue());
+            ods.update("running", true);
             return;
         }
         ConfigWaiter cs3 = new ConfigWaiter(count);
--- 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 ?
                     }
--- a/src/main/java/alice/topology/manager/StartTopologyManager.java	Mon Aug 04 08:40:28 2014 +0900
+++ b/src/main/java/alice/topology/manager/StartTopologyManager.java	Mon Aug 04 20:34:41 2014 +0900
@@ -82,6 +82,7 @@
             ods.put("createdList", new LinkedList<String>());
             ods.put("messageList", new LinkedList<HostMessage>());
             ods.put("orderHash", "order");
+            ods.put("running", false);
             
             new CreateHash();
             new IncomingHosts(topology, nodeNames);
--- a/src/main/java/alice/topology/node/ConfigurationFinish.java	Mon Aug 04 08:40:28 2014 +0900
+++ b/src/main/java/alice/topology/node/ConfigurationFinish.java	Mon Aug 04 20:34:41 2014 +0900
@@ -21,7 +21,6 @@
         int rcount = reverseCount.asInteger();
         int ncount = configNodeNum.asInteger();
         if (rcount == ncount) {
-
             ods.put("manager", "done", ValueFactory.createNilValue());
             Start cs = new Start(startCS);
             cs.done.setKey("manager", "start");
--- a/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Mon Aug 04 08:40:28 2014 +0900
+++ b/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Mon Aug 04 20:34:41 2014 +0900
@@ -37,7 +37,7 @@
                 new CreateConnectionList();
                 count++;             
             } 
-            DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
+            DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);            
             ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
             
         }