Mercurial > hg > Database > Alice
view src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 518:fc313323c53b dispose
add reconnect event
author | sugi |
---|---|
date | Thu, 22 Jan 2015 16:01:32 +0900 |
parents | 80e461aa10e9 |
children | 145c425db88d |
line wrap: on
line source
package alice.topology.node; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; import alice.datasegment.Receiver; import alice.topology.HostMessage; public class IncomingConnectionInfo extends CodeSegment { public Receiver hostInfo = ids.create(CommandType.TAKE); private String absName; private int count; public IncomingConnectionInfo(String absName, int count) { this.absName = absName; this.count = count; } @Override public void run() { if (this.hostInfo.getVal() == null) { ods.put("local", "configNodeNum", count); } else { HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class); if (DataSegment.contains(hostInfo.connectionName)) { // need to wait remove by DeleteConnection ods.put("manager", absName, hostInfo); } else { DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName); count++; ods.put("connection"+hostInfo.connectionName, hostInfo.connectionName); new PrepareToAddList(hostInfo.connectionName); } } IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count); cs.hostInfo.setKey("manager", absName); } }