Mercurial > hg > Database > Alice
annotate src/main/java/alice/topology/node/StartTopologyNode.java @ 646:3c060de44c2e
debug toplogy test
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Dec 2017 12:06:45 +0900 |
parents | cb16036404ba |
children | e321c5ec9b58 |
rev | line source |
---|---|
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 | |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
13 private final String manager; |
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
14 private final String local; |
419 | 15 private TopologyNodeConfig conf; |
16 private CodeSegment startCS; | |
17 | |
18 public StartTopologyNode(TopologyNodeConfig conf, CodeSegment startCS) { | |
19 this.conf = conf; | |
20 this.startCS = startCS; | |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
21 this.manager = conf.getManagerKey(); |
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
22 this.local = conf.getLocalKey(); |
419 | 23 } |
24 | |
25 @Override | |
26 public void run() { | |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
27 DataSegment.connect(manager, manager, conf.getManagerHostName(), conf.getManagerPort()); |
419 | 28 String localHostName = null; |
29 try { | |
562 | 30 localHostName = InetAddress.getLocalHost().getHostAddress(); |
419 | 31 } catch (UnknownHostException e) { |
32 e.printStackTrace(); | |
33 } | |
427 | 34 new SaveCookie(); |
419 | 35 |
36 HostMessage host = new HostMessage(localHostName, conf.localPort); | |
427 | 37 host.cookie = conf.cookie; |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
38 ods.put(manager, "host", host); |
419 | 39 |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
40 ods.put(local,"_CLIST", new ArrayList<String>()); |
467 | 41 |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
42 IncomingAbstractHostName cs = new IncomingAbstractHostName(conf); |
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
43 cs.absName.setKey(local, "host"); |
419 | 44 |
45 IncomingReverseKey cs2 = new IncomingReverseKey(); | |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
46 cs2.reverseKey.setKey(local, "reverseKey"); |
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
47 cs2.reverseCount.setKey(local, "reverseCount"); |
419 | 48 |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
49 ods.put(local, "reverseCount", 0); |
419 | 50 |
51 ConfigurationFinish cs3 = new ConfigurationFinish(startCS); | |
645
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
52 cs3.reverseCount.setKey(local, "reverseCount"); |
cb16036404ba
fix local topology test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
562
diff
changeset
|
53 cs3.configNodeNum.setKey(local, "configNodeNum"); |
419 | 54 |
55 } | |
56 | |
345 | 57 } |