Mercurial > hg > Database > Christie
comparison src/main/java/christie/topology/node/IncomingConnectionInfo.java @ 68:37601b98f0da
update TopologyNode
author | akahori |
---|---|
date | Sat, 01 Sep 2018 08:10:15 +0900 |
parents | 4e2453333508 |
children | c1626d2b4bb4 |
comparison
equal
deleted
inserted
replaced
67:d74a64a3940a | 68:37601b98f0da |
---|---|
8 import christie.topology.HostMessage; | 8 import christie.topology.HostMessage; |
9 import org.apache.log4j.Logger; | 9 import org.apache.log4j.Logger; |
10 | 10 |
11 public class IncomingConnectionInfo extends CodeGear { | 11 public class IncomingConnectionInfo extends CodeGear { |
12 @Peek | 12 @Peek |
13 TopologyNodeConfig topologyNodeConfig; | |
14 | |
15 @Peek | |
16 String nodeName; | 13 String nodeName; |
17 | 14 |
18 @Take | 15 @Take |
19 HostMessage remoteNodeInfo; | 16 HostMessage remoteNodeInfo; |
20 | |
21 @Take | |
22 int count; | |
23 | 17 |
24 private Logger log = Logger.getLogger(IncomingConnectionInfo.class); | 18 private Logger log = Logger.getLogger(IncomingConnectionInfo.class); |
25 | 19 |
26 | 20 |
27 public IncomingConnectionInfo() { | 21 public IncomingConnectionInfo() { |
28 } | 22 } |
29 | 23 |
30 | |
31 | |
32 @Override | 24 @Override |
33 protected void run(CodeGearManager cgm) { | 25 protected void run(CodeGearManager cgm) { |
34 String managerKey = topologyNodeConfig.getManagerKey(); | |
35 log.info(remoteNodeInfo.toString()); | 26 log.info(remoteNodeInfo.toString()); |
36 if ( remoteNodeInfo.hostName.equals("")) { // end case | 27 //if ( remoteNodeInfo.hostName.equals("")) { // end case |
37 log.info(" topology node finished " + nodeName); | 28 //return ; |
38 getLocalDGM().put("configNodeNum", 0); | 29 //} |
39 return ; | |
40 } | |
41 log.info("topology node " + nodeName + " will connect to " + remoteNodeInfo.hostName ); | 30 log.info("topology node " + nodeName + " will connect to " + remoteNodeInfo.hostName ); |
42 if (cgm.getDgmList().contains(remoteNodeInfo.connectionName)) { | |
43 // need to wait remove by DeleteConnection | |
44 getDGM("manager").put(nodeName, remoteNodeInfo); | |
45 } else { | |
46 cgm.createRemoteDGM(remoteNodeInfo.connectionName, remoteNodeInfo.hostName, remoteNodeInfo.port); | |
47 | 31 |
48 getDGM(remoteNodeInfo.connectionName).put("reverseKey", remoteNodeInfo.reverseName); | 32 cgm.createRemoteDGM(remoteNodeInfo.connectionName, remoteNodeInfo.hostName, remoteNodeInfo.port); |
49 getDGM(remoteNodeInfo.connectionName).put("reverseHostName", remoteNodeInfo.hostName); | 33 getDGM(remoteNodeInfo.connectionName).put("reverseNodeName", nodeName); |
50 getDGM(remoteNodeInfo.connectionName).put("reverseKeyPort", remoteNodeInfo.port); | |
51 | 34 |
52 count++; | 35 getLocalDGM().put("cMember", remoteNodeInfo.connectionName); |
53 | 36 cgm.setup(new CreateConnectionList()); |
54 getLocalDGM().put("cMember", remoteNodeInfo.connectionName); | |
55 cgm.setup(new CreateConnectionList()); | |
56 | |
57 } | |
58 cgm.setup(new IncomingConnectionInfo()); | 37 cgm.setup(new IncomingConnectionInfo()); |
59 getLocalDGM().put("count", count); | |
60 } | 38 } |
61 | 39 |
62 } | 40 } |