Mercurial > hg > RemoteEditor > REPSessionManager
view rep/RoutingTable.java @ 457:cf61ba25950b
merging flag handling fix
author | one |
---|---|
date | Fri, 24 Sep 2010 01:12:26 +0900 |
parents | 18cacd0b3ccf |
children |
line wrap: on
line source
package rep; import java.util.HashMap; import java.util.Map.Entry; import rep.handler.REPNode; public class RoutingTable extends HashMap<Integer,REPNode>{ /** * Routing Table for the tree structure. We keep our child, * if we don't know send it to the parent. Every ID has * session manager ID part, so we keep session manager ID * based path. */ private static final long serialVersionUID = 1L; SessionManager manager; public RoutingTable(SessionManager sessionManager) { super(); manager = sessionManager; } public void add(REPNode forwarder, int smid) { if (smid>0) put(smid, forwarder) ; } public void remove(REPNode f) { for(Entry<Integer, REPNode> entry:entrySet()) { if (entry.getValue()==f) remove(entry.getKey()); } } public void removeManager(int smid) { remove(smid); } public REPNode toSessionManager(int eid) { REPNode next = get(eid); if (next==null) return manager.smList.parent(); return next; } }