49
|
1 package christie.topology.node;
|
|
2
|
|
3
|
|
4 import christie.annotation.Take;
|
|
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
|
|
12 @Take
|
|
13 HostMessage hostInfo;
|
|
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;
|
|
24 // hostInfo.setKey(managerKey,absName);
|
|
25
|
|
26 }
|
|
27
|
|
28
|
|
29
|
|
30 @Override
|
|
31 protected void run(CodeGearManager cgm) {
|
|
32 log.info(hostInfo.toString());
|
|
33 if ( hostInfo.hostName.equals("")) { // end case
|
|
34 log.info(" topology node finished " + absName);
|
|
35 getLocalDGM().put("configNodeNum", count);
|
|
36 return ;
|
|
37 }
|
|
38 log.info("topology node " + absName + " will connect to " + hostInfo.hostName );
|
|
39 if (cgm.getDgmList().contains(hostInfo.connectionName)) {
|
|
40 // need to wait remove by DeleteConnection
|
|
41 getDGM("manager").put(absName, hostInfo);
|
|
42 } else {
|
|
43 cgm.createRemoteDGM(hostInfo.connectionName, hostInfo.hostName, hostInfo.port);
|
|
44 getDGM(hostInfo.connectionName).put("reverseKey", hostInfo.reverseName);
|
|
45 count++;
|
|
46
|
|
47 getLocalDGM().put("cMember", hostInfo.connectionName);
|
|
48 cgm.setup(new CreateConnectionList());
|
|
49 }
|
|
50 cgm.setup(new IncomingConnectionInfo(absName, count, managerKey));
|
|
51 }
|
|
52
|
|
53 }
|