49
|
1 package christie.topology.node;
|
|
2
|
|
3
|
65
|
4 import christie.annotation.Take;
|
49
|
5 import christie.codegear.CodeGear;
|
|
6 import christie.codegear.CodeGearManager;
|
|
7 import christie.topology.HostMessage;
|
|
8 import org.apache.log4j.Logger;
|
|
9
|
|
10 public class IncomingConnectionInfo extends CodeGear {
|
|
11
|
65
|
12 @Take
|
|
13 HostMessage remoteNodeInfo;
|
49
|
14
|
|
15 private String absName;
|
|
16 private int count;
|
|
17 private Logger log = Logger.getLogger(IncomingConnectionInfo.class);
|
|
18 private String managerKey;
|
|
19
|
|
20 public IncomingConnectionInfo(String absName, int count, String managerKey) {
|
|
21 this.absName = absName;
|
|
22 this.count = count;
|
|
23 this.managerKey = managerKey;
|
65
|
24 //remoteNodeInfo.setKey(managerKey,absName);
|
49
|
25 }
|
|
26
|
|
27
|
|
28
|
|
29 @Override
|
|
30 protected void run(CodeGearManager cgm) {
|
61
|
31
|
65
|
32 log.info(remoteNodeInfo.toString());
|
|
33 if ( remoteNodeInfo.hostName.equals("")) { // end case
|
49
|
34 log.info(" topology node finished " + absName);
|
61
|
35 getLocalDGM().put("configNodeNum", 0);
|
49
|
36 return ;
|
|
37 }
|
65
|
38 log.info("topology node " + absName + " will connect to " + remoteNodeInfo.hostName );
|
|
39 if (cgm.getDgmList().contains(remoteNodeInfo.connectionName)) {
|
49
|
40 // need to wait remove by DeleteConnection
|
65
|
41 getDGM("manager").put(absName, remoteNodeInfo);
|
49
|
42 } else {
|
65
|
43 cgm.createRemoteDGM(remoteNodeInfo.connectionName, remoteNodeInfo.hostName, remoteNodeInfo.port);
|
61
|
44
|
65
|
45 getDGM(remoteNodeInfo.connectionName).put("reverseKey", remoteNodeInfo.reverseName);
|
|
46 getDGM(remoteNodeInfo.connectionName).put("reverseHostName", remoteNodeInfo.hostName);
|
|
47 getDGM(remoteNodeInfo.connectionName).put("reverseKeyPort", remoteNodeInfo.port);
|
61
|
48
|
49
|
49 count++;
|
|
50
|
65
|
51 getLocalDGM().put("cMember", remoteNodeInfo.connectionName);
|
49
|
52 cgm.setup(new CreateConnectionList());
|
61
|
53
|
49
|
54 }
|
|
55 cgm.setup(new IncomingConnectionInfo(absName, count, managerKey));
|
|
56 }
|
|
57
|
|
58 }
|