Mercurial > hg > Database > Alice
changeset 416:6508ed6ea6a6 dispose
create Connection List in CreateConnection CodeSegment
author | sugi |
---|---|
date | Wed, 09 Jul 2014 03:45:14 +0900 |
parents | 79a0c18dd2c3 |
children | aadea6a59376 |
files | .project src/main/java/alice/topology/node/CreateConnectionList.java src/main/java/alice/topology/node/IncomingConnectionInfo.java src/main/java/alice/topology/node/IncomingReverseKey.java |
diffstat | 4 files changed, 37 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/.project Mon Jul 07 16:41:25 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Alice</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.springsource.ide.eclipse.gradle.core.nature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> - <filteredResources> - <filter> - <id>1404284239507</id> - <name></name> - <type>30</type> - <matcher> - <id>org.eclipse.ui.ide.multiFilter</id> - <arguments>1.0-projectRelativePath-matches-false-false-build</arguments> - </matcher> - </filter> - </filteredResources> -</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/topology/node/CreateConnectionList.java Wed Jul 09 03:45:14 2014 +0900 @@ -0,0 +1,28 @@ +package alice.topology.node; + +import java.util.List; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class CreateConnectionList extends CodeSegment { + private Receiver info = ids.create(CommandType.TAKE); // connection List + private Receiver info1 = ids.create(CommandType.TAKE); // connection names + + public CreateConnectionList() { + info.setKey("_CLIST"); + info1.setKey("cMember"); + } + + @Override + public void run() { + @SuppressWarnings("unchecked") + List<String> cList = info.asClass(List.class); + String name = info1.asString(); + cList.add(name); + ods.update(info.key, cList); + + } + +}
--- a/src/main/java/alice/topology/node/IncomingConnectionInfo.java Mon Jul 07 16:41:25 2014 +0900 +++ b/src/main/java/alice/topology/node/IncomingConnectionInfo.java Wed Jul 09 03:45:14 2014 +0900 @@ -1,7 +1,6 @@ package alice.topology.node; import java.util.ArrayList; -import java.util.List; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; @@ -12,37 +11,33 @@ public class IncomingConnectionInfo extends CodeSegment { public Receiver hostInfo = ids.create(CommandType.TAKE); - private List<String> connectionList; private String absName; private int count; public IncomingConnectionInfo(String absName, int count) { this.absName = absName; this.count = count; - this.connectionList = new ArrayList<String>(); } - public IncomingConnectionInfo(String absName, int count, List<String> connectionList) { - this.absName = absName; - this.count = count; - this.connectionList = connectionList; - } @Override public void run() { if (this.hostInfo.getVal() == null) { ods.put("local", "configNodeNum", count); - IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count, connectionList); - cs.hostInfo.setKey("manager", absName); } else { + if (count == 0) + ods.put("_CLIST", new ArrayList<String>()); + HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class); DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName); - connectionList.add(hostInfo.connectionName); - ods.update("_CLIST", connectionList); - IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count, connectionList); - cs.hostInfo.setKey("manager", absName); + ods.put("cMember", hostInfo.connectionName); + count++; + + new CreateConnectionList(); } + IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count); + cs.hostInfo.setKey("manager", absName); } }
--- a/src/main/java/alice/topology/node/IncomingReverseKey.java Mon Jul 07 16:41:25 2014 +0900 +++ b/src/main/java/alice/topology/node/IncomingReverseKey.java Wed Jul 09 03:45:14 2014 +0900 @@ -15,7 +15,6 @@ String reverseKey = this.reverseKey.asString(); String from = this.reverseKey.from; DataSegment.getAccept(from).reverseKey = reverseKey; - //new CheckRunning(); int reverseCount = this.reverseCount.asInteger(); reverseCount++;