41
|
1 package christie.topology.manager;
|
|
2
|
|
3 import christie.annotation.Peek;
|
|
4 import christie.annotation.Take;
|
|
5 import christie.codegear.CodeGear;
|
|
6 import christie.codegear.CodeGearManager;
|
|
7 import christie.topology.HostMessage;
|
|
8
|
|
9 import java.util.HashMap;
|
|
10
|
|
11 public class CheckComingHost extends CodeGear {
|
|
12
|
|
13 @Take
|
|
14 HostMessage hostMessage;
|
|
15
|
|
16 @Peek
|
|
17 HashMap<String, String> absCookieTable;
|
|
18
|
|
19 public CheckComingHost(){
|
|
20 }
|
|
21
|
|
22 @Override
|
57
|
23 protected void run(CodeGearManager cgm) {
|
41
|
24
|
|
25 // check cookie
|
|
26 if (hostMessage.cookie != null) {
|
53
|
27 if (absCookieTable.containsKey(hostMessage.cookie)) {
|
64
|
28 hostMessage.nodeName = absCookieTable.get(hostMessage.cookie);
|
41
|
29 System.out.println("match");
|
44
|
30 // coming host has ever joined this App
|
|
31 getLocalDGM().put("reconnectHost", hostMessage);
|
|
32 cgm.setup(new SearchHostName());
|
41
|
33 }
|
53
|
34 }else {
|
|
35 getLocalDGM().put("orderHash", "order");
|
|
36 getLocalDGM().put("newHost", hostMessage);
|
41
|
37 }
|
|
38 cgm.setup(new CheckComingHost());
|
|
39 }
|
|
40
|
|
41 }
|