Mercurial > hg > Database > Alice
annotate src/main/java/alice/topology/node/StartTopologyNode.java @ 587:4d38c71938f5 dispose
change ConfigrationFinish
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jan 2016 20:31:06 +0900 |
parents | ba4ec1a593f9 |
children | dd9bd18fd878 |
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; |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
6 import java.util.LinkedList; |
439 | 7 |
345 | 8 import alice.codesegment.CodeSegment; |
9 import alice.datasegment.DataSegment; | |
10 import alice.topology.HostMessage; | |
11 | |
12 public class StartTopologyNode extends CodeSegment { | |
13 | |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
14 private LinkedList<TopologyNodeConfig> configs; |
419 | 15 private TopologyNodeConfig conf; |
16 private CodeSegment startCS; | |
578 | 17 private int topMNumber; |
419 | 18 |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
19 public StartTopologyNode(LinkedList<TopologyNodeConfig> configs, CodeSegment startCS, int topMNum) { |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
20 this.configs = configs; |
585
33c011f9fb81
change topMNum count of StartAliceVNC
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
584
diff
changeset
|
21 this.conf = configs.get(topMNum - 1); |
419 | 22 this.startCS = startCS; |
578 | 23 this.topMNumber = topMNum; |
419 | 24 } |
25 | |
26 @Override | |
27 public void run() { | |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
28 DataSegment.connect("manager"+ topMNumber, "manager" + topMNumber, conf.getManagerHostName(), conf.getManagerPort()); |
419 | 29 String localHostName = null; |
30 try { | |
562 | 31 localHostName = InetAddress.getLocalHost().getHostAddress(); |
419 | 32 } catch (UnknownHostException e) { |
33 e.printStackTrace(); | |
34 } | |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
35 new SaveCookie(topMNumber); |
419 | 36 |
578 | 37 HostMessage host = new HostMessage(localHostName, conf.localPort, topMNumber); |
427 | 38 host.cookie = conf.cookie; |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
39 ods.put("manager" + topMNumber, "host", host); |
419 | 40 |
439 | 41 ods.put("_CLIST", new ArrayList<String>()); |
467 | 42 |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
43 IncomingAbstractHostName cs = new IncomingAbstractHostName(topMNumber); |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
44 cs.absName.setKey("local", "host"+topMNumber); |
419 | 45 |
46 IncomingReverseKey cs2 = new IncomingReverseKey(); | |
47 cs2.reverseKey.setKey("local", "reverseKey"); | |
48 cs2.reverseCount.setKey("local", "reverseCount"); | |
49 | |
50 ods.put("local", "reverseCount", 0); | |
51 | |
586
ba4ec1a593f9
change topMNum count of StartAliceVNC
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
585
diff
changeset
|
52 if (topMNumber == 1){ |
587
4d38c71938f5
change ConfigrationFinish
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
586
diff
changeset
|
53 ConfigurationFinish cs3 = new ConfigurationFinish(startCS, topMNumber); |
584
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
54 cs3.reverseCount.setKey("local", "reverseCount"); |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
55 cs3.configNodeNum.setKey("local", "configNodeNum"); |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
56 } else { |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
57 new StartTopologyNode(configs, startCS, topMNumber - 1).execute(); |
8f765e3eed24
add Topology Manager Number to Topology Node Key
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
578
diff
changeset
|
58 } |
419 | 59 |
60 } | |
61 | |
345 | 62 } |