⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routingtable.java

📁 openfire 服务器源码下载
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * {@link XMPPServer#isLocal(org.xmpp.packet.JID)} to figure out if the address
     * belongs to tge domain hosted by this server.
     *
     * @param jid the address of the route.
     * @return true if the specified address belongs to a route that is hosted by this JVM.
     */
    boolean isLocalRoute(JID jid);

    /**
     * Returns true if an outgoing server session exists to the specified remote server.
     * The JID can be a full JID or a bare JID since only the domain of the specified
     * address will be used to look up the route.<p>
     *
     * When running inside of a cluster the look up will be done in all the cluster. So
     * as long as a node has a connection to the remote server a true value will be
     * returned.
     *
     * @param jid JID that specifies the remote server address.
     * @return true if an outgoing server session exists to the specified remote server.
     */
    boolean hasServerRoute(JID jid);

    /**
     * Returns true if an internal or external component is hosting the specified address.
     * The JID can be a full JID or a bare JID since only the domain of the specified
     * address will be used to look up the route.<p>
     *
     * When running inside of a cluster the look up will be done in all the cluster. So
     * as long as a node is hosting the component  a true value will be returned.
     *
     * @param jid JID that specifies the component address.
     * @return true if an internal or external component is hosting the specified address.
     */
    boolean hasComponentRoute(JID jid);

    /**
     * Returns the client session associated to the specified XMPP address or <tt>null</tt>
     * if none was found. When running inside of a cluster and a remote node is hosting
     * the client session then a session surrage will be returned.
     *
     * @param jid the address of the session.
     * @return the client session associated to the specified XMPP address or null if none was found.
     */
    ClientSession getClientRoute(JID jid);

    /**
     * Returns collection of client sessions authenticated with the server. When running inside
     * of a cluster the returned sessions will include sessions connected to this JVM and also
     * other cluster nodes.
     *
     * TODO Prevent usage of this message and change original requirement to avoid having to load all sessions.
     * TODO This may not scale when hosting millions of sessions.
     *
     * @param onlyLocal true if only client sessions connected to this JVM must be considered.
     * @return collection of client sessions authenticated with the server.
     */
    Collection<ClientSession> getClientsRoutes(boolean onlyLocal);

    /**
     * Returns the outgoing server session associated to the specified XMPP address or <tt>null</tt>
     * if none was found. When running inside of a cluster and a remote node is hosting
     * the session then a session surrage will be returned.
     *
     * @param jid the address of the session.
     * @return the outgoing server session associated to the specified XMPP address or null if none was found.
     */
    OutgoingServerSession getServerRoute(JID jid);

    /**
     * Returns a collection with the hostnames of the remote servers that currently may receive
     * packets sent from this server.
     *
     * @return a collection with the hostnames of the remote servers that currently may receive
     *         packets sent from this server.
     */
    Collection<String> getServerHostnames();

    /**
     * Returns the number of outgoing server sessions hosted in this JVM. When runing inside of
     * a cluster you will need to get this value for each cluster node to learn the total number
     * of outgoing server sessions.
     *
     * @return the number of outgoing server sessions hosted in this JVM.
     */
    int getServerSessionsCount();

    /**
     * Returns domains of components hosted by the server. When running in a cluster, domains of
     * components running in any node will be returned.
     *
     * @return domains of components hosted by the server.
     */
    Collection<String> getComponentsDomains();

    /**
     * Returns the list of routes associated to the specified route address. When asking
     * for routes to a remote server then the requested JID will be included as the only
     * value of the returned collection. It is indifferent if an outgoing session to the
     * specified remote server exists or not.<p>
     *
     * When asking for routes to client sessions the specified route address could either
     * be a full JID of a bare JID. In the case of a full JID, a single element will be
     * included in the answer in case the specified full JID exists or an empty collection
     * if the full JID does not exist. Moreover, when passing a bare JID a list of full
     * JIDs will be returned for each available resource associated to the bare JID. In
     * any case, only JIDs of <tt>available</tt> client sessions are returned. However,
     * there is an exception with directed presences. Unavailable routes may be returned
     * if and only if the owner of the route sent a directed presence to the requester
     * thus becoming available to the requester. If requester is <tt>null</tt> then only
     * available resources are considered.<p>
     *
     * When asking for routes to components a single element will be returned in the answer
     * only if an internal or external component is found for the specified route address.
     * If no component was found then an empty collection will be returned.
     *
     * @param route The address we want a route to.
     * @param requester The address of the entity requesting the routes or null if we don't
     * care about directed presences.
     * @return list of routes associated to the specified route address.
     */
    List<JID> getRoutes(JID route, JID requester);

    /**
     * Returns true if a route of a client session has been successfully removed. When running
     * inside of a cluster this message <tt>must</tt> be sent from the cluster node that is
     * actually hosting the client session.
     *
     * @param route the route to remove.
     * @return true if a route of a client session has been successfully removed.
     */
    boolean removeClientRoute(JID route);

    /**
     * Returns true if a route to an outoing server has been successfully removed. When running
     * inside of a cluster this message <tt>must</tt> be sent from the cluster node that is
     * actually holding the physical connectoin to the remote server. 
     *
     * @param route the route to remove.
     * @return true if the route was successfully removed.
     */
    boolean removeServerRoute(JID route);

    /**
     * Returns true if a route of a component has been successfully removed. Both internal
     * and external components have a route in the table. When running inside of a cluster
     * this message <tt>must</tt> be sent from the cluster node that is actually hosting the
     * component.
     *
     * @param route the route to remove.
     * @return true if a route of a component has been successfully removed.
     */
    boolean removeComponentRoute(JID route);

    /**
     * Sets the {@link RemotePacketRouter} to use for deliverying packets to entities hosted
     * in remote nodes of the cluster.
     *
     * @param remotePacketRouter the RemotePacketRouter to use for deliverying packets to entities hosted
     *        in remote nodes of the cluster.
     */
    void setRemotePacketRouter(RemotePacketRouter remotePacketRouter);

    /**
     * Returns the {@link RemotePacketRouter} to use for deliverying packets to entities hosted
     * in remote nodes of the cluster or <tt>null</tt> if none was set.
     *
     * @return the RemotePacketRouter to use for deliverying packets to entities hosted
     *        in remote nodes of the cluster.
     */
    RemotePacketRouter getRemotePacketRouter();

    /**
     * Broadcasts the specified message to connected client sessions to the local node or
     * across the cluster. Both available and unavailable client sessions will receive the message.
     *
     * @param packet the message to broadcast.
     * @param onlyLocal true if only client sessions connecte to the local JVM will get the message.
     */
    void broadcastPacket(Message packet, boolean onlyLocal);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -