Mercurial > hg > Database > Alice
annotate src/alice/topology/node/IncomingConnectionInfo.java @ 31:5c704b9a9a87
add ring script
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 17 Jan 2012 20:24:46 +0900 |
parents | 98ab26e09a98 |
children | 2bfb796b0fa1 |
rev | line source |
---|---|
25 | 1 package alice.topology.node; |
2 | |
3 import java.io.IOException; | |
4 | |
5 import org.msgpack.MessagePack; | |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
6 import org.msgpack.type.ValueFactory; |
25 | 7 |
8 import alice.codesegment.CodeSegment; | |
9 import alice.datasegment.CommandType; | |
10 import alice.datasegment.DataSegment; | |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
11 import alice.datasegment.DataSegmentManager; |
25 | 12 import alice.datasegment.DataSegmentReceiver; |
13 import alice.topology.HostMessage; | |
14 | |
15 public class IncomingConnectionInfo extends CodeSegment { | |
16 | |
17 public DataSegmentReceiver hostInfo = new DataSegmentReceiver(ids, CommandType.TAKE); | |
26 | 18 private String absName; |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
19 private int count; |
26 | 20 |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
21 public IncomingConnectionInfo(String absName, int count) { |
25 | 22 this.absName = absName; |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
23 this.count = count; |
25 | 24 } |
25 | |
26 @Override | |
27 public void run() { | |
27 | 28 if (this.hostInfo.val == null) { |
31 | 29 ods.put("local", "configNodeNum", count); |
26 | 30 return; |
31 } | |
25 | 32 MessagePack msgpack = new MessagePack(); |
33 try { | |
34 HostMessage hostInfo = msgpack.convert(this.hostInfo.val, HostMessage.class); | |
31 | 35 DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); |
36 //manager.put("reverseKey", ValueFactory.createRawValue(hostInfo.reverseName)); | |
37 ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName); | |
25 | 38 } catch (IOException e) { |
39 e.printStackTrace(); | |
40 } | |
26 | 41 |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
42 IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count); |
26 | 43 cs.hostInfo.setKey("manager", absName); |
25 | 44 } |
45 | |
46 } |