Mercurial > hg > Database > Alice
view src/main/java/alice/topology/manager/CheckComingHost.java @ 547:e91a574b69de dispose
remove index
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 18 Aug 2015 16:15:17 +0900 |
parents | 15eeb439830c |
children | 9f577ff4f7ea |
line wrap: on
line source
package alice.topology.manager; import java.util.HashMap; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.topology.HostMessage; public class CheckComingHost extends CodeSegment { // checkIncomingHost private Receiver host = ids.create(CommandType.TAKE); private Receiver absCookieTable = ids.create(CommandType.PEEK); // cookie, AbsName HashMap public CheckComingHost(){ this.host.setKey("host", this); this.absCookieTable.setKey("absCookieTable", this); } @Override public void run() { HostMessage host = this.host.asClass(HostMessage.class); @SuppressWarnings("unchecked") HashMap<String, String> absCookieTable = this.absCookieTable.asClass(HashMap.class); boolean match = false; // check cookie if (host.cookie != null) { if (absCookieTable.containsKey(host.cookie)){ match = true; host.absName = absCookieTable.get(host.cookie); System.out.println("match"); } } if (match){ // coming host has ever joined this App ods.put("reconnectHost", host); new SearchHostName(); } else { ods.put("orderHash", "order"); ods.put("newHost", host); } new CheckComingHost(); } }