Mercurial > hg > Database > Christie
comparison src/main/java/christie/topology/node/TopologyNode.java @ 58:9922e6decbe8
fix conf
author | akahori |
---|---|
date | Fri, 24 Aug 2018 11:12:20 +0900 |
parents | fd944876257b |
children | 20d4c0cce914 |
comparison
equal
deleted
inserted
replaced
57:f4b388422045 | 58:9922e6decbe8 |
---|---|
10 import java.util.ArrayList; | 10 import java.util.ArrayList; |
11 | 11 |
12 public class TopologyNode extends CodeGear{ | 12 public class TopologyNode extends CodeGear{ |
13 | 13 |
14 private final String manager; | 14 private final String manager; |
15 private final String local; | 15 private TopologyNodeConfig topologyNodeConfig; |
16 private TopologyNodeConfig conf; | |
17 private CodeGear startCS; | 16 private CodeGear startCS; |
18 | 17 |
19 public TopologyNode(TopologyNodeConfig conf, CodeGear startCS) { | 18 public TopologyNode(TopologyNodeConfig conf, CodeGear startCS) { |
20 this.conf = conf; | 19 this.topologyNodeConfig = conf; |
21 this.startCS = startCS; | 20 this.startCS = startCS; |
22 this.manager = conf.getManagerKey(); | 21 this.manager = conf.getManagerKey(); |
23 this.local = conf.getLocalKey(); | |
24 } | 22 } |
25 | 23 |
26 @Override | 24 @Override |
27 protected void run(CodeGearManager cgm) { | 25 protected void run(CodeGearManager cgm) { |
28 cgm.createRemoteDGM(manager, conf.getManagerHostName(), conf.getManagerPort()); | 26 cgm.createRemoteDGM(manager, |
27 topologyNodeConfig.getManagerHostName(), | |
28 topologyNodeConfig.getManagerPort()); | |
29 String localHostName = null; | 29 String localHostName = null; |
30 try { | 30 try { |
31 localHostName = InetAddress.getLocalHost().getHostAddress(); | 31 localHostName = InetAddress.getLocalHost().getHostAddress(); |
32 } catch (UnknownHostException e) { | 32 } catch (UnknownHostException e) { |
33 e.printStackTrace(); | 33 e.printStackTrace(); |
34 } | 34 } |
35 cgm.setup(new SaveCookie()); | 35 cgm.setup(new SaveCookie()); |
36 if (cgm.localPort == 0) { | 36 if (cgm.localPort == 0) { |
37 // local test mode | 37 // local test mode |
38 localHostName = conf.getLocalKey(); | 38 localHostName = topologyNodeConfig.getLocalKey(); |
39 } | 39 } |
40 getLocalDGM().put("config" , conf ); | 40 getLocalDGM().put("config" , topologyNodeConfig); |
41 | 41 |
42 HostMessage host = new HostMessage(localHostName, cgm.localPort); | 42 HostMessage host = new HostMessage(localHostName, cgm.localPort); |
43 host.cookie = conf.cookie; | 43 host.cookie = topologyNodeConfig.cookie; |
44 getDGM(manager).put("hostMessage", host); | 44 getDGM(manager).put("hostMessage", host); |
45 | 45 |
46 getLocalDGM().put("_CLIST", new ArrayList<String>()); | 46 getLocalDGM().put("_CLIST", new ArrayList<String>()); |
47 //getDGM(local).put("_CLIST", new ArrayList<String>()); | 47 //getDGM(local).put("_CLIST", new ArrayList<String>()); |
48 | 48 |
49 cgm.setup(new IncomingAbstractHostName(conf)); | 49 cgm.setup(new IncomingAbstractHostName(topologyNodeConfig)); |
50 | 50 |
51 cgm.setup(new IncomingReverseKey()); | 51 cgm.setup(new IncomingReverseKey()); |
52 | 52 |
53 getLocalDGM().put("reverseCount", 0); | 53 getLocalDGM().put("reverseCount", 0); |
54 | 54 |