Mercurial > hg > Database > Alice
comparison src/alice/topology/node/StartTopologyNode.java @ 34:ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Jan 2012 16:01:50 +0900 |
parents | b5a21baf0b07 |
children | 1a498f436332 |
comparison
equal
deleted
inserted
replaced
33:20c67f673224 | 34:ca079a730d0b |
---|---|
1 package alice.topology.node; | 1 package alice.topology.node; |
2 | 2 |
3 import java.io.IOException; | |
4 import java.net.InetAddress; | 3 import java.net.InetAddress; |
5 import java.net.UnknownHostException; | 4 import java.net.UnknownHostException; |
6 | 5 |
7 import org.msgpack.MessagePack; | |
8 import org.msgpack.type.ValueFactory; | |
9 | |
10 import alice.codesegment.CodeSegment; | 6 import alice.codesegment.CodeSegment; |
11 import alice.datasegment.DataSegment; | 7 import alice.datasegment.DataSegment; |
12 import alice.datasegment.DataSegmentManager; | |
13 import alice.topology.HostMessage; | 8 import alice.topology.HostMessage; |
14 | 9 |
15 public class StartTopologyNode extends CodeSegment { | 10 public class StartTopologyNode extends CodeSegment { |
16 | 11 |
17 private TopologyNodeConfig conf; | 12 private TopologyNodeConfig conf; |
22 this.clazz = clazz; | 17 this.clazz = clazz; |
23 } | 18 } |
24 | 19 |
25 @Override | 20 @Override |
26 public void run() { | 21 public void run() { |
27 DataSegmentManager manager = DataSegment.connect("manager", "", conf.managerHostName, conf.managerPort); | 22 DataSegment.connect("manager", "", conf.managerHostName, conf.managerPort); |
23 String localHostName = null; | |
28 try { | 24 try { |
29 HostMessage host; | 25 localHostName = InetAddress.getLocalHost().getHostName(); |
30 host = new HostMessage(InetAddress.getLocalHost().getHostName(), conf.localPort); | |
31 MessagePack msgpack = new MessagePack(); | |
32 manager.put("host", msgpack.unconvert(host)); | |
33 } catch (UnknownHostException e) { | 26 } catch (UnknownHostException e) { |
34 e.printStackTrace(); | 27 e.printStackTrace(); |
35 } catch (IOException e) { | |
36 e.printStackTrace(); | |
37 } | 28 } |
29 HostMessage host; | |
30 host = new HostMessage(localHostName, conf.localPort); | |
31 ods.put("manager", "host", host); | |
38 | 32 |
39 IncomingAbstractHostName cs1 = new IncomingAbstractHostName(); | 33 IncomingAbstractHostName cs1 = new IncomingAbstractHostName(); |
40 cs1.absName.setKey("local", "host"); | 34 cs1.absName.setKey("local", "host"); |
41 | 35 |
42 IncomingReverseKey cs2 = new IncomingReverseKey(); | 36 IncomingReverseKey cs2 = new IncomingReverseKey(); |
43 cs2.reverseKey.setKey("local", "reverseKey"); | 37 cs2.reverseKey.setKey("local", "reverseKey"); |
44 cs2.reverseCount.setKey("local", "reverseCount"); | 38 cs2.reverseCount.setKey("local", "reverseCount"); |
45 | 39 |
46 ods.put("local", "reverseCount", ValueFactory.createIntegerValue(0)); | 40 ods.put("local", "reverseCount", 0); |
47 | 41 |
48 ConfigurationFinish cs3 = new ConfigurationFinish(clazz); | 42 ConfigurationFinish cs3 = new ConfigurationFinish(clazz); |
49 cs3.reverseCount.setKey("local", "reverseCount"); | 43 cs3.reverseCount.setKey("local", "reverseCount"); |
50 cs3.configNodeNum.setKey("local", "configNodeNum"); | 44 cs3.configNodeNum.setKey("local", "configNodeNum"); |
51 } | 45 } |