Mercurial > hg > Database > Alice
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 |
rev | line source |
---|---|
433 | 1 package alice.topology.manager; |
2 | |
434 | 3 import java.util.HashMap; |
433 | 4 import alice.codesegment.CodeSegment; |
5 import alice.datasegment.CommandType; | |
6 import alice.datasegment.Receiver; | |
7 import alice.topology.HostMessage; | |
8 | |
9 public class CheckComingHost extends CodeSegment { | |
10 // checkIncomingHost | |
466 | 11 private Receiver host = ids.create(CommandType.TAKE); |
435 | 12 private Receiver absCookieTable = ids.create(CommandType.PEEK); // cookie, AbsName HashMap |
434 | 13 |
433 | 14 public CheckComingHost(){ |
647 | 15 this.host.setKey("hostMessage"); |
434 | 16 this.absCookieTable.setKey("absCookieTable"); |
433 | 17 } |
434 | 18 |
433 | 19 @Override |
20 public void run() { | |
21 HostMessage host = this.host.asClass(HostMessage.class); | |
22 @SuppressWarnings("unchecked") | |
434 | 23 HashMap<String, String> absCookieTable = this.absCookieTable.asClass(HashMap.class); |
433 | 24 boolean match = false; |
25 // check cookie | |
26 if (host.cookie != null) { | |
434 | 27 if (absCookieTable.containsKey(host.cookie)){ |
28 match = true; | |
29 host.absName = absCookieTable.get(host.cookie); | |
436 | 30 System.out.println("match"); |
433 | 31 } |
32 } | |
434 | 33 |
466 | 34 if (match){ |
433 | 35 // coming host has ever joined this App |
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 | 38 } else { |
39 ods.put("orderHash", "order"); | |
40 ods.put("newHost", host); | |
41 } | |
434 | 42 |
43 new CheckComingHost(); | |
433 | 44 } |
45 | |
46 } |