Commit afa35221 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Initial version.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8337 b35dd754-fafc-0310-a699-88a17e54d16e
parent f48fd1e1
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
/**
* A RemotePacketRouter is responsible for deliverying packets to entities hosted
* in remote nodes of the cluster.
*
* @author Gaston Dombiak
*/
public interface RemotePacketRouter {
/**
* Routes packet to specified receipient hosted in the specified node.
*
* @param nodeID the ID of the node hosting the receipient.
* @param receipient the target entity that will get the packet.
* @param packet the packet to send.
* @return true if the remote node was found.
*/
boolean routePacket(byte[] nodeID, JID receipient, Packet packet);
}
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire.spi;
import org.jivesoftware.openfire.RoutableChannelHandler;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Internal component used by the RoutingTable to keep references to routes hosted by this JVM. When
* running in a cluster each cluster member will have its own RoutingTable containing an instance of
* this class. Each LocalRoutingTable is responsible for storing routes to components, client sessions
* and outgoing server sessions hosted by local cluster node.
*
* @author Gaston Dombiak
*/
class LocalRoutingTable {
Map<String, RoutableChannelHandler> routes = new ConcurrentHashMap<String, RoutableChannelHandler>();
/**
* Adds a route of a local {@link RoutableChannelHandler}
*
* @param address the string representation of the JID associated to the route.
* @param route the route hosted by this node.
*/
void addRoute(String address, RoutableChannelHandler route) {
routes.put(address, route);
}
/**
* Returns the route hosted by this node that is associated to the specified address.
*
* @param address the string representation of the JID associated to the route.
* @return the route hosted by this node that is associated to the specified address.
*/
RoutableChannelHandler getRoute(String address) {
return routes.get(address);
}
/**
* Removes a route of a local {@link RoutableChannelHandler}
*
* @param address the string representation of the JID associated to the route.
*/
void removeRoute(String address) {
routes.remove(address);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment