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
|
94
|
25 String cookie = hostMessage.getCookie();
|
41
|
26 // check cookie
|
94
|
27 if (cookie != null) {
|
|
28 if (absCookieTable.containsKey(cookie)) {
|
|
29 hostMessage.setNodeName(cookie);
|
41
|
30 System.out.println("match");
|
44
|
31 // coming host has ever joined this App
|
|
32 getLocalDGM().put("reconnectHost", hostMessage);
|
|
33 cgm.setup(new SearchHostName());
|
41
|
34 }
|
53
|
35 }else {
|
|
36 getLocalDGM().put("orderHash", "order");
|
|
37 getLocalDGM().put("newHost", hostMessage);
|
41
|
38 }
|
|
39 cgm.setup(new CheckComingHost());
|
|
40 }
|
|
41
|
|
42 }
|