Mercurial > hg > Database > Alice
view src/main/java/alice/topology/manager/reconnection/CheckABSName.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
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"); } }