annotate src/main/java/alice/topology/manager/CheckComingHost.java @ 655:1c93e82e05c6 default tip

fix timestamp
author suruga
date Sat, 17 Feb 2018 00:33:00 +0900
parents e321c5ec9b58
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
1 package alice.topology.manager;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
2
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
3 import java.util.HashMap;
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
4 import alice.codesegment.CodeSegment;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
5 import alice.datasegment.CommandType;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
6 import alice.datasegment.Receiver;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
7 import alice.topology.HostMessage;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
8
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
9 public class CheckComingHost extends CodeSegment {
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
10 // checkIncomingHost
466
268b1280dc18 remove debug message
sugi
parents: 436
diff changeset
11 private Receiver host = ids.create(CommandType.TAKE);
435
41bb86275910 send MD5 "mode -t"
sugi
parents: 434
diff changeset
12 private Receiver absCookieTable = ids.create(CommandType.PEEK); // cookie, AbsName HashMap
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
13
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
14 public CheckComingHost(){
647
e321c5ec9b58 fix toplogy manager; ring worked
suruga
parents: 523
diff changeset
15 this.host.setKey("hostMessage");
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
16 this.absCookieTable.setKey("absCookieTable");
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
17 }
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
18
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
19 @Override
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
20 public void run() {
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
21 HostMessage host = this.host.asClass(HostMessage.class);
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
22 @SuppressWarnings("unchecked")
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
23 HashMap<String, String> absCookieTable = this.absCookieTable.asClass(HashMap.class);
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
24 boolean match = false;
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
25 // check cookie
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
26 if (host.cookie != null) {
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
27 if (absCookieTable.containsKey(host.cookie)){
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
28 match = true;
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
29 host.absName = absCookieTable.get(host.cookie);
436
a9ed8e932a1e pass reconnect test but have many bug
sugi
parents: 435
diff changeset
30 System.out.println("match");
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
31 }
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
32 }
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
33
466
268b1280dc18 remove debug message
sugi
parents: 436
diff changeset
34 if (match){
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
35 // coming host has ever joined this App
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
36 ods.put("reconnectHost", host);
523
145c425db88d add CompressedLDSM
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 517
diff changeset
37 new SearchHostName();
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
38 } else {
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
39 ods.put("orderHash", "order");
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
40 ods.put("newHost", host);
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
41 }
434
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
42
4c62f76894c8 refactoring
sugi
parents: 433
diff changeset
43 new CheckComingHost();
433
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
44 }
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
45
e565d481c52e separate checking process from IncomingHosts
sugi
parents:
diff changeset
46 }