Mercurial > hg > Members > tatsuki > Alice
view src/alice/topology/manager/reconnection/CheckConnectionList.java @ 275:99026285c5dc
changeset: 274 is failed But this is success
author | sugi |
---|---|
date | Sun, 29 Sep 2013 17:40:26 +0900 |
parents | f866178f3018 |
children |
line wrap: on
line source
package alice.topology.manager.reconnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.topology.HostMessage; public class CheckConnectionList extends CodeSegment { private Receiver name = ids.create(CommandType.TAKE); private Receiver connection = ids.create(CommandType.TAKE); private Receiver abs = ids.create(CommandType.PEEK); private Receiver clone = ids.create(CommandType.TAKE); public CheckConnectionList(){ name.setKey("_RECABSNAME"); connection.setKey("connection"); abs.setKey("_ABSIPTABLE"); clone.setKey("_HMCLONE"); } @Override public void run() { @SuppressWarnings("unchecked") HashMap<String, ArrayList<HostMessage>> connectionList = connection.asClass(HashMap.class); @SuppressWarnings("unchecked") List<HostMessage> ABSIPList = abs.asClass(List.class); String absName = name.asClass(String.class); HostMessage oldInfo = clone.asClass(HostMessage.class); HostMessage newInfo = null; for (HostMessage mes : ABSIPList){ if (mes.absName.equals(absName)){ newInfo = mes; break; } } List<HostMessage> clist = connectionList.get(absName); for (HostMessage mes : clist){ mes.setFlag(); ods.put(absName, mes); for (HostMessage mes2 : ABSIPList){ if (mes.name.equals(mes2.name)&&mes.port == mes2.port){ String absName2 = mes2.getABSName(); List<HostMessage> clist2 = connectionList.get(absName2); for (HostMessage mes3 : clist2){ if (mes3.name.equals(oldInfo.name)&&mes3.port == oldInfo.port){ mes3.name = newInfo.name; mes3.port = newInfo.port; mes3.setFlag(); ods.put(absName2, "_RECODATA", mes3); break; } } break; } } } System.out.println("SendHost Data"); ods.put(absName, ValueFactory.createNilValue()); ods.update("connection", connectionList); new ReceiveError(); } }