Mercurial > hg > Database > Alice
view src/main/java/alice/topology/manager/CheckComingHost.java @ 655:1c93e82e05c6 default tip
fix timestamp
author | suruga |
---|---|
date | Sat, 17 Feb 2018 00:33:00 +0900 |
parents | e321c5ec9b58 |
children |
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("hostMessage"); this.absCookieTable.setKey("absCookieTable"); } @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(); } }