345
|
1 package alice.topology.node;
|
|
2
|
|
3 import java.util.ArrayList;
|
|
4 import java.util.List;
|
|
5
|
|
6 import alice.codesegment.CodeSegment;
|
|
7 import alice.datasegment.CommandType;
|
|
8 import alice.datasegment.DataSegment;
|
|
9 import alice.datasegment.Receiver;
|
|
10 import alice.topology.HostMessage;
|
|
11
|
|
12 public class IncomingConnectionInfo extends CodeSegment {
|
|
13
|
|
14 public Receiver hostInfo = ids.create(CommandType.TAKE);
|
|
15 private List<String> connectionList;
|
|
16 private String absName;
|
|
17 private int count;
|
|
18
|
|
19 public IncomingConnectionInfo(String absName, int count) {
|
|
20 this.absName = absName;
|
|
21 this.count = count;
|
|
22 this.connectionList = new ArrayList<String>();
|
|
23 }
|
|
24
|
|
25 public IncomingConnectionInfo(String absName, int count, List<String> connectionList) {
|
|
26 this.absName = absName;
|
|
27 this.count = count;
|
|
28 this.connectionList = connectionList;
|
|
29 }
|
|
30
|
|
31 @Override
|
|
32 public void run() {
|
|
33 if (this.hostInfo.getVal() == null) {
|
|
34 ods.put("local", "configNodeNum", count);
|
|
35 return;
|
|
36 }
|
|
37
|
|
38 HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
|
|
39 //System.out.println(hostInfo.reconnectFlag);
|
|
40 DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port, hostInfo.reconnectFlag);
|
|
41 ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
|
|
42 connectionList.add(hostInfo.connectionName);
|
|
43 ods.update("_CLIST", connectionList);
|
|
44 IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count, connectionList);
|
|
45 cs.hostInfo.setKey("manager", absName);
|
|
46
|
|
47 }
|
|
48
|
|
49 }
|