Mercurial > hg > Database > Alice
view src/alice/topology/node/StartTopologyNode.java @ 28:98ab26e09a98
Configuration Manager work and implements reverseKey
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 17 Jan 2012 08:41:34 +0900 |
parents | f54dcbebde3a |
children | b5a21baf0b07 |
line wrap: on
line source
package alice.topology.node; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import org.msgpack.MessagePack; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.DataSegment; import alice.datasegment.DataSegmentManager; import alice.topology.HostMessage; public class StartTopologyNode extends CodeSegment { private TopologyNodeConfig conf; private Class<CodeSegment> clazz; public StartTopologyNode(TopologyNodeConfig conf, Class<CodeSegment> clazz) { this.conf = conf; this.clazz = clazz; } @Override public void run() { DataSegmentManager manager = DataSegment.connect("manager", "", conf.managerHostName, conf.managerPort); try { HostMessage host; host = new HostMessage(InetAddress.getLocalHost().getHostName(), conf.localPort); MessagePack msgpack = new MessagePack(); manager.put("host", msgpack.unconvert(host)); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } IncomingAbstractHostName cs1 = new IncomingAbstractHostName(); cs1.absName.setKey("local", "host"); IncomingReverseKey cs2 = new IncomingReverseKey(); cs2.reverseKey.setKey("local", "reverseKey"); cs2.reverseCount.setKey("local", "reverseCount"); ods.put("local", "reverseCount", ValueFactory.createIntegerValue(0)); ConfigurationFinish cs3 = new ConfigurationFinish(clazz); cs3.reverseCount.setKey("local", "reverseCount"); cs3.configNodeNum.setKey("local", "configNodeNum"); } }