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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
1 package alice.topology.node;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
2
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
3 import java.net.InetAddress;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
4 import java.net.UnknownHostException;
439
9f6674e503df change timing putting Connection list
sugi
parents: 427
diff changeset
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
9f6674e503df change timing putting Connection list
sugi
parents: 427
diff changeset
7
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
8 import alice.codesegment.CodeSegment;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
9 import alice.datasegment.DataSegment;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
10 import alice.topology.HostMessage;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
11
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
12 public class StartTopologyNode extends CodeSegment {
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
15 private TopologyNodeConfig conf;
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
16 private CodeSegment startCS;
578
ffa43f252492 add getTailIndex
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
17 private int topMNumber;
419
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
22 this.startCS = startCS;
578
ffa43f252492 add getTailIndex
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
23 this.topMNumber = topMNum;
419
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
24 }
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
25
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
26 @Override
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
29 String localHostName = null;
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
30 try {
562
1cf2697d51a6 add j3dcore.jar to lib
Nozomi
parents: 523
diff changeset
31 localHostName = InetAddress.getLocalHost().getHostAddress();
419
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
32 } catch (UnknownHostException e) {
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
33 e.printStackTrace();
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
36
578
ffa43f252492 add getTailIndex
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
37 HostMessage host = new HostMessage(localHostName, conf.localPort, topMNumber);
427
6a5925219dc6 add argument "-cookie"
sugi
parents: 419
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
40
439
9f6674e503df change timing putting Connection list
sugi
parents: 427
diff changeset
41 ods.put("_CLIST", new ArrayList<String>());
467
6e304a7a60e7 remove white space
sugi
parents: 439
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
45
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
46 IncomingReverseKey cs2 = new IncomingReverseKey();
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
47 cs2.reverseKey.setKey("local", "reverseKey");
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
48 cs2.reverseCount.setKey("local", "reverseCount");
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
49
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
50 ods.put("local", "reverseCount", 0);
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
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
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
59
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
60 }
aefbe41fcf12 change tab to space
sugi
parents: 404
diff changeset
61
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
62 }