changeset 516:a7f140f4bcb1 dispose

add Code Segment (PrepareToAddList)
author sugi
date Wed, 21 Jan 2015 16:56:31 +0900
parents 6161dcd3da02
children 80e461aa10e9
files src/main/java/alice/daemon/Connection.java src/main/java/alice/topology/node/IncomingConnectionInfo.java src/main/java/alice/topology/node/IncomingReverseKey.java src/main/java/alice/topology/node/PrepareToAddList.java
diffstat 4 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/daemon/Connection.java	Wed Jan 21 14:08:26 2015 +0900
+++ b/src/main/java/alice/daemon/Connection.java	Wed Jan 21 16:56:31 2015 +0900
@@ -62,6 +62,7 @@
             if (sendManager) {
                 SendOption option = new SendOption(false, false);
                 DataSegment.get("manager").put("_DISCONNECTNODE", rData, option);
+                sendManager = false;
             }
         }
 
--- a/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Wed Jan 21 14:08:26 2015 +0900
+++ b/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Wed Jan 21 16:56:31 2015 +0900
@@ -31,9 +31,9 @@
                 DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
                 ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
                 count++;
+                ods.put("connection"+hostInfo.connectionName, hostInfo.connectionName);
+                new PrepareToAddList(hostInfo.connectionName);
 
-                ods.put("cMember", hostInfo.connectionName);
-                new CreateConnectionList();
             }
 
         }
--- a/src/main/java/alice/topology/node/IncomingReverseKey.java	Wed Jan 21 14:08:26 2015 +0900
+++ b/src/main/java/alice/topology/node/IncomingReverseKey.java	Wed Jan 21 16:56:31 2015 +0900
@@ -19,7 +19,7 @@
         int reverseCount = this.reverseCount.asInteger();
         reverseCount++;
         ods.update("local", "reverseCount", reverseCount);
-
+        ods.put("connection"+reverseKey, reverseKey);
         IncomingReverseKey cs = new IncomingReverseKey();
         cs.reverseKey.setKey("local", "reverseKey");
         cs.reverseCount.setKey("local", "reverseCount");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/topology/node/PrepareToAddList.java	Wed Jan 21 16:56:31 2015 +0900
@@ -0,0 +1,24 @@
+package alice.topology.node;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class PrepareToAddList extends CodeSegment {
+
+    public Receiver info = ids.create(CommandType.TAKE);
+    public Receiver info2 = ids.create(CommandType.TAKE);
+
+    public PrepareToAddList(String key) {
+        info.setKey("connection"+key);
+        info2.setKey("connection"+key);
+    }
+
+    @Override
+    public void run() {
+        String connectionName = info.asString();
+        ods.put("cMember", connectionName);
+        new CreateConnectionList();
+    }
+
+}