Mercurial > hg > Database > Alice
changeset 549:9f577ff4f7ea dispose
resolve TopologyManager NullPointerException
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 06 Oct 2015 17:50:53 +0900 |
parents | b44a2bf16eb3 |
children | 90a39835a100 |
files | build.gradle src/main/java/alice/codesegment/CodeSegmentManager.java src/main/java/alice/daemon/IncomingTcpConnection.java src/main/java/alice/test/codesegment/local/TestCodeSegment.java src/main/java/alice/topology/fix/ReceiveDisconnectMessage.java src/main/java/alice/topology/manager/CheckComingHost.java src/main/java/alice/topology/manager/ComingServiceHosts.java src/main/java/alice/topology/manager/CreateHash.java src/main/java/alice/topology/manager/StartTopologyManager.java |
diffstat | 9 files changed, 23 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/build.gradle Tue Aug 25 19:54:30 2015 +0900 +++ b/build.gradle Tue Oct 06 17:50:53 2015 +0900 @@ -7,7 +7,7 @@ [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' group = 'cr.ie.u_ryukyu.ac.jp' -version = '1.0' +version = '1.1' dependencies { compile fileTree(dir: 'lib', include: '*.jar') @@ -22,7 +22,7 @@ } ext { - mavenRepository = System.getenv()['HOME']+'/workspace/maven' + mavenRepository = System.getenv()['HOME']+'/Development/CR/maven' } uploadArchives {
--- a/src/main/java/alice/codesegment/CodeSegmentManager.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/codesegment/CodeSegmentManager.java Tue Oct 06 17:50:53 2015 +0900 @@ -43,8 +43,10 @@ } else { csManager.codeSegmentExecutor.setThreadFactory(csManager.maxPriority); } + cs.ods.alice = alice; cs.ids.alice = alice; + csManager.codeSegmentExecutor.execute(cs); if (csManager.logger.isDebugEnabled()) { csManager.logger.debug(cs.getClass().getName());
--- a/src/main/java/alice/daemon/IncomingTcpConnection.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/daemon/IncomingTcpConnection.java Tue Oct 06 17:50:53 2015 +0900 @@ -69,7 +69,7 @@ switch (type) { case UPDATE: case PUT: - if (msg.compressed) { + if (msg.compressed) {// ToDo:あとでunpackの方法統一したい rData = new ReceiveData(packer.read(unpacker.getSerializedByteArray(unpacker.readInt()), byte[].class), true, msg.dataSize); } else { rData = new ReceiveData(unpacker.getSerializedByteArray(unpacker.readInt()), false, msg.dataSize);
--- a/src/main/java/alice/test/codesegment/local/TestCodeSegment.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/test/codesegment/local/TestCodeSegment.java Tue Oct 06 17:50:53 2015 +0900 @@ -13,7 +13,6 @@ @Override public void run() { - System.out.println("in TestCodeSegment"); System.out.println("type = " + arg1.type); int num = arg1.asInteger(); System.out.println("data = " + num);
--- a/src/main/java/alice/topology/fix/ReceiveDisconnectMessage.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/topology/fix/ReceiveDisconnectMessage.java Tue Oct 06 17:50:53 2015 +0900 @@ -7,13 +7,14 @@ public class ReceiveDisconnectMessage extends CodeSegment { private Receiver info = ids.create(CommandType.PEEK); - public ReceiveDisconnectMessage() { + public ReceiveDisconnectMessage(CodeSegment cs) { + this.aliceDaemon = cs.aliceDaemon; info.setKey("_DISCONNECTNODE", this); } @Override public void run() { new FixTopology(); - new ReceiveDisconnectMessage(); + new ReceiveDisconnectMessage(this); } }
--- a/src/main/java/alice/topology/manager/CheckComingHost.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/topology/manager/CheckComingHost.java Tue Oct 06 17:50:53 2015 +0900 @@ -11,7 +11,8 @@ private Receiver host = ids.create(CommandType.TAKE); private Receiver absCookieTable = ids.create(CommandType.PEEK); // cookie, AbsName HashMap - public CheckComingHost(){ + public CheckComingHost(CodeSegment cs){ + this.aliceDaemon = cs.aliceDaemon; this.host.setKey("host", this); this.absCookieTable.setKey("absCookieTable", this); } @@ -40,7 +41,7 @@ ods.put("newHost", host); } - new CheckComingHost(); + new CheckComingHost(this); } }
--- a/src/main/java/alice/topology/manager/ComingServiceHosts.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/topology/manager/ComingServiceHosts.java Tue Oct 06 17:50:53 2015 +0900 @@ -8,14 +8,15 @@ private Receiver info = ids.create(CommandType.PEEK); - public ComingServiceHosts(){ + public ComingServiceHosts(CodeSegment cs){ + this.aliceDaemon = cs.aliceDaemon; info.setKey("newHost", this); } @Override public void run() { new CreateTreeTopology(); - new ComingServiceHosts(); + new ComingServiceHosts(this); } }
--- a/src/main/java/alice/topology/manager/CreateHash.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/topology/manager/CreateHash.java Tue Oct 06 17:50:53 2015 +0900 @@ -16,7 +16,8 @@ private Receiver info = ids.create(CommandType.TAKE); // order to create private Receiver info1 = ids.create(CommandType.TAKE); - public CreateHash(){ + public CreateHash(CodeSegment cs){ + this.aliceDaemon = cs.aliceDaemon; info.setKey("orderHash", this); info1.setKey("createdList", this); } @@ -48,7 +49,7 @@ ods.put("MD5", MD5); } catch (NoSuchAlgorithmException e) { } - new CreateHash(); + new CreateHash(this); } private String convertMD5(String raw) throws NoSuchAlgorithmException{
--- a/src/main/java/alice/topology/manager/StartTopologyManager.java Tue Aug 25 19:54:30 2015 +0900 +++ b/src/main/java/alice/topology/manager/StartTopologyManager.java Tue Oct 06 17:50:53 2015 +0900 @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.LinkedList; +import alice.daemon.AliceDaemon; import org.apache.log4j.Logger; import alice.codesegment.CodeSegment; @@ -25,12 +26,13 @@ Logger logger = Logger.getLogger(StartTopologyManager.class); public StartTopologyManager(TopologyManagerConfig conf) { + this.aliceDaemon = new AliceDaemon(conf); this.conf = conf; } @Override public void run() { - new CheckComingHost(); + new CheckComingHost(this); ods.put("absCookieTable", new HashMap<String, String>()); if (!conf.dynamic) { @@ -102,14 +104,14 @@ ods.put("parentManager", manager); ods.put("nameTable", nameTable); ods.put("hostCount", cominghostCount); - new ComingServiceHosts(); - new ReceiveDisconnectMessage(); + new ComingServiceHosts(this); + new ReceiveDisconnectMessage(this); } } ods.put("topology", new HashMap<String, LinkedList<HostMessage>>()); ods.put("createdList", new LinkedList<String>()); - new CreateHash(); + new CreateHash(this); TopologyFinish cs2 = new TopologyFinish(); cs2.finish.setKey("local", "finish", this);