Mercurial > hg > RemoteEditor > REPSessionManager
view rep/RoutingTable.java @ 495:bd76f7e39247 no-global-seq-mode
comment
author | one |
---|---|
date | Sun, 24 Oct 2010 00:18:14 +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; } }