Mercurial > hg > Members > tatsuki > Alice
diff src/alice/topology/node/IncomingConnectionInfo.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 | 5c704b9a9a87 |
line wrap: on
line diff
--- a/src/alice/topology/node/IncomingConnectionInfo.java Tue Jan 17 03:52:39 2012 +0900 +++ b/src/alice/topology/node/IncomingConnectionInfo.java Tue Jan 17 08:41:34 2012 +0900 @@ -3,10 +3,12 @@ import java.io.IOException; import org.msgpack.MessagePack; +import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; +import alice.datasegment.DataSegmentManager; import alice.datasegment.DataSegmentReceiver; import alice.topology.HostMessage; @@ -14,37 +16,30 @@ public DataSegmentReceiver hostInfo = new DataSegmentReceiver(ids, CommandType.TAKE); private String absName; - private Class<CodeSegment> clazz; + private int count; - public IncomingConnectionInfo(String absName, Class<CodeSegment> clazz) { + public IncomingConnectionInfo(String absName, int count) { this.absName = absName; - this.clazz = clazz; + this.count = count; } @Override public void run() { if (this.hostInfo.val == null) { - System.out.println("Configuration finished"); - if (clazz == null) - return; - try { - clazz.newInstance().execute(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + ods.put("local", "configNodeNum", ValueFactory.createIntegerValue(count)); + return; } MessagePack msgpack = new MessagePack(); try { HostMessage hostInfo = msgpack.convert(this.hostInfo.val, HostMessage.class); - DataSegment.connect(hostInfo.connectionName, hostInfo.name, hostInfo.port); + DataSegmentManager manager = DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); + manager.put("reverseKey", ValueFactory.createRawValue(hostInfo.reverseName)); } catch (IOException e) { e.printStackTrace(); } - IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, clazz); + IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count); cs.hostInfo.setKey("manager", absName); }