345
|
1 package alice.topology.node;
|
|
2
|
|
3 import java.net.InetAddress;
|
|
4 import java.net.UnknownHostException;
|
439
|
5 import java.util.ArrayList;
|
|
6
|
345
|
7 import alice.codesegment.CodeSegment;
|
|
8 import alice.datasegment.DataSegment;
|
|
9 import alice.topology.HostMessage;
|
|
10
|
|
11 public class StartTopologyNode extends CodeSegment {
|
|
12
|
419
|
13 private TopologyNodeConfig conf;
|
|
14 private CodeSegment startCS;
|
|
15
|
|
16 public StartTopologyNode(TopologyNodeConfig conf, CodeSegment startCS) {
|
|
17 this.conf = conf;
|
|
18 this.startCS = startCS;
|
|
19 }
|
|
20
|
|
21 @Override
|
|
22 public void run() {
|
480
|
23 DataSegment.connect("manager", "manager", conf.getManagerHostName(), conf.getManagerPort());
|
419
|
24 String localHostName = null;
|
|
25 try {
|
|
26 localHostName = InetAddress.getLocalHost().getHostName();
|
|
27 } catch (UnknownHostException e) {
|
|
28 e.printStackTrace();
|
|
29 }
|
427
|
30 new SaveCookie();
|
419
|
31
|
|
32 HostMessage host = new HostMessage(localHostName, conf.localPort);
|
427
|
33 host.cookie = conf.cookie;
|
419
|
34 ods.put("manager", "host", host);
|
|
35
|
439
|
36 ods.put("_CLIST", new ArrayList<String>());
|
467
|
37
|
419
|
38 IncomingAbstractHostName cs = new IncomingAbstractHostName();
|
|
39 cs.absName.setKey("local", "host");
|
|
40
|
|
41 IncomingReverseKey cs2 = new IncomingReverseKey();
|
|
42 cs2.reverseKey.setKey("local", "reverseKey");
|
|
43 cs2.reverseCount.setKey("local", "reverseCount");
|
|
44
|
|
45 ods.put("local", "reverseCount", 0);
|
|
46
|
|
47 ConfigurationFinish cs3 = new ConfigurationFinish(startCS);
|
|
48 cs3.reverseCount.setKey("local", "reverseCount");
|
|
49 cs3.configNodeNum.setKey("local", "configNodeNum");
|
|
50
|
|
51 }
|
|
52
|
345
|
53 }
|