Mercurial > hg > Database > Alice
changeset 466:268b1280dc18 dispose
remove debug message
author | sugi |
---|---|
date | Sat, 15 Nov 2014 04:48:35 +0900 |
parents | cf0eb5b2b4d2 |
children | 6e304a7a60e7 |
files | src/main/java/alice/test/topology/ring/FirstRingMessagePassing.java src/main/java/alice/test/topology/ring/RingMessagePassing.java src/main/java/alice/topology/manager/CheckComingHost.java src/main/java/alice/topology/manager/CreateHash.java src/main/java/alice/topology/manager/IncomingHosts.java src/main/java/alice/topology/manager/RecodeTopology.java src/main/java/alice/topology/manager/SearchHostName.java |
diffstat | 7 files changed, 35 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/test/topology/ring/FirstRingMessagePassing.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/test/topology/ring/FirstRingMessagePassing.java Sat Nov 15 04:48:35 2014 +0900 @@ -27,7 +27,7 @@ @Override public void run() { - ods.put("right", "c", ds1.getVal()); // copy whole DataSegment to the right + ods.put("right", "c", ds1.getReceiveData()); // copy whole DataSegment to the right if (ds1.index > count) { // after count time update of ds1 ods.put("right", "finish", ValueFactory.createNilValue()); long endTime = System.nanoTime();
--- a/src/main/java/alice/test/topology/ring/RingMessagePassing.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/test/topology/ring/RingMessagePassing.java Sat Nov 15 04:48:35 2014 +0900 @@ -10,7 +10,7 @@ @Override public void run() { - ods.put("right", "c", this.ds1.getVal()); + ods.put("right", "c", this.ds1.getReceiveData()); RingMessagePassing cs = new RingMessagePassing(); cs.ds1.setKey("c"); }
--- a/src/main/java/alice/topology/manager/CheckComingHost.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/topology/manager/CheckComingHost.java Sat Nov 15 04:48:35 2014 +0900 @@ -8,7 +8,7 @@ public class CheckComingHost extends CodeSegment { // checkIncomingHost - private Receiver host = ids.create(CommandType.TAKE); + private Receiver host = ids.create(CommandType.TAKE); private Receiver absCookieTable = ids.create(CommandType.PEEK); // cookie, AbsName HashMap public CheckComingHost(){ @@ -31,13 +31,11 @@ } } - if (match){ + if (match){ // coming host has ever joined this App - System.out.println("reconnect host"); ods.put("reconnectHost", host); new SearchHostName(); } else { - System.out.println("new host"); ods.put("orderHash", "order"); ods.put("newHost", host); }
--- a/src/main/java/alice/topology/manager/CreateHash.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/topology/manager/CreateHash.java Sat Nov 15 04:48:35 2014 +0900 @@ -12,26 +12,25 @@ public class CreateHash extends CodeSegment{ // this CodeSegment change raw string to MD5 - + private Receiver info = ids.create(CommandType.TAKE); // order to create - private Receiver info1 = ids.create(CommandType.TAKE); - + private Receiver info1 = ids.create(CommandType.TAKE); + public CreateHash(){ info.setKey("orderHash"); info1.setKey("createdList"); } - + @Override public void run() { - System.out.println("created"); @SuppressWarnings("unchecked") LinkedList<String> createdRawList = this.info1.asClass(LinkedList.class); boolean checkNewStr = false; String raw = null; - + while (!checkNewStr){ raw = RandomStringUtils.randomAscii(10); - // checking raw String has already created + // checking raw String has already created int count = 0; for (String str : createdRawList) { if (raw.equals(str)) break; @@ -42,17 +41,16 @@ } createdRawList.add(raw); ods.put(info1.key, createdRawList); - + try { // convert to MD5 String MD5 = convertMD5(raw); ods.put("MD5", MD5); } catch (NoSuchAlgorithmException e) { } - System.out.println("put hash"); new CreateHash(); } - + private String convertMD5(String raw) throws NoSuchAlgorithmException{ MessageDigest md = MessageDigest.getInstance("MD5"); md.update(raw.getBytes()); @@ -67,5 +65,5 @@ } return builder.toString(); } - + }
--- a/src/main/java/alice/topology/manager/IncomingHosts.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/topology/manager/IncomingHosts.java Sat Nov 15 04:48:35 2014 +0900 @@ -37,9 +37,7 @@ @SuppressWarnings("unchecked") LinkedList<String> nodeNames = this.nodeNames.asClass(LinkedList.class); - - System.out.println("new node come"); - // not have or match cookie + // not have or match cookie String nodeName = nodeNames.poll(); // Manager connect to Node DataSegment.connect(nodeName, "", host.name, host.port); @@ -69,10 +67,10 @@ ods.put("local", key, ValueFactory.createNilValue()); } } - + ods.put(this.nodeNames.key, nodeNames); ods.put(this.topology.key, topology); - + new IncomingHosts(); } }
--- a/src/main/java/alice/topology/manager/RecodeTopology.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/topology/manager/RecodeTopology.java Sat Nov 15 04:48:35 2014 +0900 @@ -11,7 +11,7 @@ public class RecodeTopology extends CodeSegment { private Receiver info = ids.create(CommandType.TAKE); // NodeInfo - private Receiver info1 = ids.create(CommandType.TAKE); // HashMap + private Receiver info1 = ids.create(CommandType.TAKE); // HashMap public RecodeTopology(){ info.setKey("nodeInfo"); @@ -23,7 +23,7 @@ HostMessage hostInfo = info.asClass(HostMessage.class); @SuppressWarnings("unchecked") HashMap<String, LinkedList<HostMessage>> topology = info1.asClass(HashMap.class); - LinkedList<HostMessage> connections; + LinkedList<HostMessage> connections; if (!topology.containsKey(hostInfo.remoteAbsName)) { connections = new LinkedList<HostMessage>(); } else { @@ -31,14 +31,14 @@ } connections.add(hostInfo); topology.put(hostInfo.remoteAbsName, connections); - - for (LinkedList<HostMessage> list :topology.values()){ - System.out.print(list.get(0).remoteAbsName+" : "); - for (HostMessage host : list){ - System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); - } - System.out.println(); - } +// need debug option +// for (LinkedList<HostMessage> list :topology.values()){ +// System.out.print(list.get(0).remoteAbsName+" : "); +// for (HostMessage host : list){ +// System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); +// } +// System.out.println(); +// } ods.update(info1.key, topology); }
--- a/src/main/java/alice/topology/manager/SearchHostName.java Thu Nov 13 17:57:37 2014 +0900 +++ b/src/main/java/alice/topology/manager/SearchHostName.java Sat Nov 15 04:48:35 2014 +0900 @@ -15,7 +15,7 @@ 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 + private Receiver info2 = ids.create(CommandType.PEEK); // check App running public SearchHostName(){ info.setKey("reconnectHost"); @@ -33,8 +33,8 @@ DataSegment.remove(hostInfo.absName); DataSegment.connect(hostInfo.absName, "", hostInfo.name, hostInfo.port); ods.put(hostInfo.absName, "host", hostInfo.absName); - - // put Host dataSegment on reconnect node + + // put Host dataSegment on reconnect node if (topology.containsKey(hostInfo.absName)) { LinkedList<HostMessage> clist = topology.get(hostInfo.absName); ods.put(hostInfo.absName, "dummy"); // this is bug @@ -51,21 +51,21 @@ for (LinkedList<HostMessage> list :topology.values()){ for (HostMessage host : list){ - // find and update old info - if (hostInfo.absName.equals(host.absName)){ - if (!hostInfo.name.equals(host.name) || (hostInfo.port != host.port)){ + // find and update old info + if (hostInfo.absName.equals(host.absName)){ + if (!hostInfo.name.equals(host.name) || (hostInfo.port != host.port)){ host.name = hostInfo.name; host.port = hostInfo.port; - + ods.put(host.remoteAbsName, host); - + } else { // nothing to do ? } } } } - + for (LinkedList<HostMessage> list :topology.values()){ System.out.print(list.get(0).remoteAbsName+" : "); for (HostMessage host : list){