Mercurial > hg > Database > Alice
view src/alice/topology/manager/reconnection/CheckABSName.java @ 274:f866178f3018
success to reconnect
author | sugi |
---|---|
date | Sun, 29 Sep 2013 17:17:10 +0900 |
parents | 3667ab045530 |
children |
line wrap: on
line source
package alice.topology.manager.reconnection; import java.util.List; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; import alice.datasegment.Receiver; import alice.topology.HostMessage; public class CheckABSName extends CodeSegment{ private Receiver abs = ids.create(CommandType.PEEK); private Receiver host = ids.create(CommandType.TAKE); private HostMessage message; public CheckABSName(HostMessage mes) { message = mes; abs.setKey("_ABSIPTABLE"); host.setKey("host"); } @Override public void run() { System.out.println("CheckABSName"); @SuppressWarnings("unchecked") List<HostMessage> ABSIPList = abs.asClass(List.class); HostMessage hostInfo = host.asClass(HostMessage.class); for (HostMessage mes : ABSIPList){ if (mes.name.equals(message.name)&&mes.port == message.port){ DataSegment.remove(mes.getABSName()); DataSegment.connect(mes.getABSName(), "", hostInfo.name, hostInfo.port, hostInfo.reconnectFlag); ods.put(mes.getABSName(), "host", mes.getABSName()); ods.put("_RECABSNAME", mes.getABSName()); ods.put("_HMCLONE", new HostMessage(mes.name, mes.port)); mes.port = hostInfo.port; mes.name = hostInfo.name; ods.update("_ABSIPTABLE", ABSIPList); new CheckConnectionList(); return; } } ods.put("host", hostInfo); new ReceiveError(); System.out.println("not match"); } }