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

📄 rendezvousserviceprovider.java

📁 jxta_src_2.41b jxta 2.41b 最新版源码 from www.jxta.org
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            if (rendezvousServiceMonitor != null) {                this.rendezvousMeter = rendezvousServiceMonitor.getRendezvousMeter();            }        }    }    /**     * Resets the local idea of the lease to the specified value.     * As a result a lease response must be sought and obtained within the     * new specified delay or the rdv is considered disconnected.     *     * @param  peer The peer to be challenged     * @param delay The delay     */    public abstract void challengeRendezVous(ID peer, long delay);    /**     * Remove a RendezVousService point.     *     * @param peerID the PeerId of the RendezVous to disconnect from.     */    public abstract void disconnectFromRendezVous(ID peerID);    /**     * Returns an Enumeration of the PeerID all the RendezVous on which this Peer is currently connected.     *     * @return Enumeration enumeration of RendezVous     */    public abstract Enumeration getConnectedRendezVous();    /**     * Returns an Enumeration of the PeerID all the RendezVous on which this     * Peer failed to connect to.     *     * @return Enumeration enumeration of RendezVous     */    public abstract Enumeration getDisconnectedRendezVous();    /**     *  {@inheritDoc}     */    public abstract Vector getConnectedPeerIDs();    /**     *  {@inheritDoc}     */    public abstract Enumeration getConnectedPeers();    /**     ** {@inheritDoc}     */    public abstract void setChoiceDelay(long delay);    /**     ** This portion is for peers that are RendezVous     */    /**     * Propagates a message onto as many peers on the local network     * as possible. Typically the message will go to all the peers to     * which at least one endpoint transport can address without using     * the router.     *     * This method sends the message to all peers, rendezvous peers and     * edge peer. This method of propagation is very expensive and should     * not be frequently used. When rendezvous peers are used in order to     * cache index of data, it is more efficient to use the walk() method.     *     * Only a single HOP at a time is performed. Messages are always     * delivered to the destination handler on arrival. This handler     * is responsible for repropagating further, if deemed appropriate.     *     * Loop and TTL control are performed automatically.     *     * Messages can be propagated via this method for the first time or     * can be re-propagated by re-using a message that came in via propagation.     * In the later case, the TTL and loop detection parameters CANNOT be     * re-initialized. If one wants to "re-propagate" a message with a new TTL     * and blank gateways list one must generate a completely new message.     * This limits the risk of accidental propagation storms, although they     * can always be engineered deliberately.     *     * Note: The original msg is not modified and may be reused upon return.     *     * @param msg is the message to propagate.     * @param serviceName is the name of the service     * @param serviceParam is the parameter of the service     */    public abstract void propagate(Message msg, String serviceName, String serviceParam, int ttl) throws IOException;    /**     * Propagates a message onto as many peers on the local network     * as possible. Typically the message will go to all the peers to     * which at least one endpoint transport can address without using     * the router.     *     * This method sends the message to all peers, rendezvous peers and     * edge peer. This method of propagation is very expensive and should     * not be frequently used. When rendezvous peers are used in order to     * cache index of data, it is more efficient to use the walk() method.     *     * Only a single HOP at a time is performed. Messages are always     * delivered to the destination handler on arrival. This handler     * is responsible for repropagating further, if deemed appropriate.     *     * Loop and TTL control are performed automatically.     *     * Messages can be propagated via this method for the first time or     * can be re-propagated by re-using a message that came in via propagation.     * In the later case, the TTL and loop detection parameters CANNOT be     * re-initialized. If one wants to "re-propagate" a message with a new TTL     * and blank gateways list one must generate a completely new message.     * This limits the risk of accidental propagation storms, although they     * can always be engineered deliberately.     *     * Note: The original msg is not modified and may be reused upon return.     *     * @param destPeerIDs is a vector of PeerID of the peers that are recipients     * of the propagated message.     * @param msg is the message to propagate.     * @param serviceName is the name of the service     * @param serviceParam is the parameter of the service     */    public abstract void propagate(Enumeration destPeerIds, Message msg, String serviceName, String serviceParam, int ttl) throws IOException;    /**     * Propagates a message onto as many peers on the local network     * as possible. Typically the message will go to all the peers to     * which at least one endpoint transport can address without using     * the router.     *     * Only a single HOP at a time is performed. Messages are always     * delivered to the destination handler on arrival. This handler     * is responsible for repropagating further, if deemed appropriate.     *     * Loop and TTL control are performed automatically.     *     * Messages can be propagated via this method for the first time or     * can be re-propagated by re-using a message that came in via propagation.     * In the later case, the TTL and loop detection parameters CANNOT be     * re-initialized. If one wants to "re-propagate" a message with a new TTL     * and blank gateways list one must generate a completely new message.     * This limits the risk of accidental propagation storms, although they     * can always be engineered deliberately.     *     * Note: The original msg is not modified and may be reused upon return.     *     * @param msg is the message to propagate.     * @param serviceName is the name of the service     * @param serviceParam is the parameter of the service     * @param prunePeer is a peer to prune in the propagation.     */    public abstract void propagateToNeighbors(Message msg, String serviceName, String serviceParam, int ttl) throws IOException;    /**     * Return true if connected to a rendezvous.     *     * @return    true if connected to a rendezvous, false otherwise     */    public abstract boolean isConnectedToRendezVous();    /**     ** The following API is related to the new Rendezvous Peer walk     ** mechanism.     */    /**     * Walk a message through the rendezvous peers of the network: only     * rendezvous peers will receive the message.     *     * Only a single HOP at a time is performed. Messages are always     * delivered to the destination handler on arrival. This handler     * is responsible for repropagating further, if deemed appropriate.     *     * Loop and TTL control are performed automatically.     *     * Messages can be propagated via this method for the first time or     * can be re-propagated by re-using a message that came in via propagation.     * In the later case, the TTL and loop detection parameters CANNOT be     * re-initialized. If one wants to "re-propagate" a message with a new TTL     * and blank gateways list one must generate a completely new message.     * This limits the risk of accidental propagation storms, although they     * can always be engineered deliberately.     *     * Note: The original msg is not modified and may be reused upon return.     *     * @param msg is the message to walk.     * @param serviceName is the name of the service     * @param serviceParam is the parameter of the service     * @param ttl is the maximum TTL of the message (note that the Rendezvous     * Service implementation is free to decrease that value.     * @throws IOException when walking the message is impossible (network failure)     */    public abstract void walk(Message msg, String serviceName, String serviceParam, int ttl) throws IOException;    /**     * Walk a message through the rendezvous peers of the network: only     * rendezvous peers will receive the message.     *     * Only a single HOP at a time is performed. Messages are always     * delivered to the destination handler on arrival. This handler     * is responsible for repropagating further, if deemed appropriate.     *     * Loop and TTL control are performed automatically.     *     * Messages can be propagated via this method for the first time or     * can be re-propagated by re-using a message that came in via propagation.     * In the later case, the TTL and loop detection parameters CANNOT be     * re-initialized. If one wants to "re-propagate" a message with a new TTL     * and blank gateways list one must generate a completely new message.     * This limits the risk of accidental propagation storms, although they     * can always be engineered deliberately.     *     * Note: The original msg is not modified and may be reused upon return.     *     * @param destPeerIDs is a Vector of PeerID of the peers which are receiving     * first the walker. Note that each entry in the Vector will create its own     * walker.     * @param msg is the message to walk.     * @param serviceName is the name of the service     * @param serviceParam is the parameter of the service     * @param ttl is the maximum TTL of the message (note that the Rendezvous     * Service implementation is free to decrease that value.     * @throws IOException when walking the message is impossible (network failure)     */    public abstract void walk(Vector  destPeerIDs, Message msg, String serviceName, String serviceParam, int ttl) throws IOException;    /**     * Process a propagated message.     */    protected void processReceivedMessage(Message message, RendezVousPropagateMessage propHdr, EndpointAddress srcAddr, EndpointAddress dstAddr) {        EndpointListener listener = rdvService.getListener(dstAddr.getServiceName() + dstAddr.getServiceParameter());        if (listener != null) {            // We have a local listener for this message.            // Deliver it.            if (LOG.isEnabledFor(Level.DEBUG)) {                LOG.debug(                    "Calling local listener " + listener.getClass().getName()+ " for [" + dstAddr.getServiceName() + dstAddr.getServiceParameter() + "] with " + message + " ("                    + propHdr.getMsgId() + ")");            }            try {                listener.processIncomingMessage(message, srcAddr, dstAddr);            } catch (Throwable ignored) {                if (LOG.isEnabledFor(Level.ERROR)) {                    LOG.error("Uncaught Throwable during callback of (" + listener + ") to " + dstAddr, ignored);                }            }            if (RendezvousMeterBuildSettings.RENDEZVOUS_METERING && (rendezvousMeter != null)) {                rendezvousMeter.receivedMessageProcessedLocally();            }        } else {            if (LOG.isEnabledFor(Level.DEBUG)) {                LOG.debug("No message listener found for ServiceName :" +  dstAddr.getServiceName()+                          " ServiceParam :"+ dstAddr.getServiceParameter());            }        }        if (rdvService.isRendezVous() || (listener == null)) {            // We do not have a local listener. Repropagate it.            if (LOG.isEnabledFor(Level.DEBUG)) {                LOG.debug("Repropagating " + message + " (" + propHdr.getMsgId() + ")");            }            if (RendezvousMeterBuildSettings.RENDEZVOUS_METERING && (rendezvousMeter != null)) {                rendezvousMeter.receivedMessageRepropagatedInGroup();

⌨️ 快捷键说明

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