25
|
1 package alice.topology.node;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.net.InetAddress;
|
|
5 import java.net.UnknownHostException;
|
|
6
|
|
7 import org.msgpack.MessagePack;
|
|
8
|
|
9 import alice.codesegment.CodeSegment;
|
|
10 import alice.datasegment.DataSegment;
|
|
11 import alice.datasegment.DataSegmentManager;
|
|
12 import alice.topology.HostMessage;
|
|
13
|
|
14 public class StartTopologyNode extends CodeSegment {
|
|
15
|
|
16 TopologyNodeConfig conf;
|
|
17
|
|
18 public StartTopologyNode(TopologyNodeConfig conf) {
|
|
19 this.conf = conf;
|
|
20 }
|
|
21
|
|
22 @Override
|
|
23 public void run() {
|
|
24 DataSegmentManager manager = DataSegment.connect("topology_manager", conf.managerHostName, conf.managerPort);
|
|
25 try {
|
|
26 HostMessage host;
|
|
27 host = new HostMessage(InetAddress.getLocalHost().getHostName(), conf.localPort);
|
|
28 MessagePack msgpack = new MessagePack();
|
|
29 manager.put("host", msgpack.unconvert(host));
|
|
30 } catch (UnknownHostException e) {
|
|
31 e.printStackTrace();
|
|
32 } catch (IOException e) {
|
|
33 e.printStackTrace();
|
|
34 }
|
|
35
|
|
36 IncomingAbstractHostName cs = new IncomingAbstractHostName();
|
|
37 cs.absName.setKey("local", "host");
|
|
38 }
|
|
39
|
|
40 }
|