/*
* Copyright (c) 2001-2007 Sun Microsystems, Inc. All rights reserved.
*
* The Sun Project JXTA(TM) Software License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by Sun Microsystems, Inc. for JXTA(TM) technology."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" must
* not be used to endorse or promote products derived from this software
* without prior written permission. For written permission, please contact
* Project JXTA at http://www.jxta.org.
*
* 5. Products derived from this software may not be called "JXTA", nor may
* "JXTA" appear in their name, without prior written permission of Sun.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SUN
* MICROSYSTEMS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* JXTA is a registered trademark of Sun Microsystems, Inc. in the United
* States and other countries.
*
* Please see the license information page at :
* <http://www.jxta.org/project/www/license.html> for instructions on use of
* the license in source files.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many individuals
* on behalf of Project JXTA. For more information on Project JXTA, please see
* http://www.jxta.org.
*
* This license is based on the BSD license adopted by the Apache Foundation.
*/
package net.jxta.impl.endpoint.router;
import net.jxta.document.Advertisement;
import net.jxta.document.AdvertisementFactory;
import net.jxta.document.XMLElement;
import net.jxta.endpoint.EndpointAddress;
import net.jxta.endpoint.EndpointListener;
import net.jxta.endpoint.EndpointService;
import net.jxta.endpoint.Message;
import net.jxta.endpoint.MessageReceiver;
import net.jxta.endpoint.MessageSender;
import net.jxta.endpoint.MessageTransport;
import net.jxta.endpoint.Messenger;
import net.jxta.endpoint.MessengerEvent;
import net.jxta.endpoint.MessengerEventListener;
import net.jxta.exception.PeerGroupException;
import net.jxta.id.ID;
import net.jxta.id.IDFactory;
import net.jxta.impl.endpoint.IllegalTransportLoopException;
import net.jxta.impl.endpoint.LoopbackMessenger;
import net.jxta.impl.util.TimeUtils;
import net.jxta.impl.util.TimerThreadNamer;
import net.jxta.logging.Logging;
import net.jxta.peer.PeerID;
import net.jxta.peergroup.PeerGroup;
import net.jxta.platform.Module;
import net.jxta.protocol.AccessPointAdvertisement;
import net.jxta.protocol.ModuleImplAdvertisement;
import net.jxta.protocol.PeerAdvertisement;
import net.jxta.protocol.RouteAdvertisement;
import net.jxta.service.Service;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
public class EndpointRouter implements EndpointListener, MessageReceiver, MessageSender, MessengerEventListener, Module {
/**
* Logger
*/
private final static transient Logger LOG = Logger.getLogger(EndpointRouter.class.getName());
/**
* Until we decide otherwise, the router is *by definition* handling
* virtually addressed messages.
*/
private final static String ROUTER_PROTOCOL_NAME = "jxta";
/**
* Router Service Name
*/
private final static String ROUTER_SERVICE_NAME = "EndpointRouter";
/**
* how long we are willing to wait for a response from an async
* getMessenger. We do not wait long at all because it is non-critical
* that we get the answer synchronously. The goal is to avoid starting
* a route discovery if there's a chance to get a direct connection.
* However, we will still take advantage of the direct route if it is
* found while we wait for the route discovery result. If that happens,
* the only wrong is that we used some bandwidth doing a route discovery
* that wasn't needed after all.
*/
public final static long ASYNC_MESSENGER_WAIT = 3L * TimeUtils.ASECOND;
/**
* MessageTransport Control operation
*/
public final static Integer GET_ROUTE_CONTROL = 0; // Return RouteControl Object
public final static int RouteControlOp = 0; // Return RouteControl Object
/**
* MAX timeout (seconds) for route discovery after that timeout
* the peer will bail out from finding a route
*/
private final static long MAX_FINDROUTE_TIMEOUT = 60L * TimeUtils.ASECOND;
/**
* How long do we wait (seconds) before retrying to make a connection
* to an endpoint destination
*/
private final static long MAX_ASYNC_GETMESSENGER_RETRY = 30L * TimeUtils.ASECOND;
/**
* These are peers which we know multi-hop routes for.
*/
private final Map<ID, RouteAdvertisement> routedRoutes = new HashMap<ID, RouteAdvertisement>(16);
/**
* A record of failures.
* <p/>
* Values are the time of failure as {@link java.lang.Long}. If
* {@code Long.MAX_VALUE} then a connect attempt is current in progress.
*/
private final Map<PeerID, Long> triedAndFailed = new HashMap<PeerID, Long>();
/**
* local peer ID as an endpointAddress.
*/
private EndpointAddress localPeerAddr = null;
/**
* local Peer ID
*/
private PeerID localPeerId = null;
/**
* The Endpoint Service we are routing for.
*/
private EndpointService endpoint = null;
/**
* PeerGroup handle
*/
private PeerGroup group = null;
private ID assignedID = null;
/**
* If {@code true} this service has been closed.
*/
private boolean stopped = false;
/**
* Whenever we initiate connectivity to a peer (creating a direct route).
* we remember that we need to send our route adv to that peer. So that
* it has a chance to re-establish the connection from its side, if need
* be. The route adv is actually sent piggy-backed on the first message
* that goes there.
*/
private final Set<EndpointAddress> newDestinations = Collections.synchronizedSet(new HashSet<EndpointAddress>());
/**
* A pool of messengers categorized by logical address.
* This actu
没有合适的资源?快使用搜索试试~ 我知道了~
jxse-src-2.5_rc2.rar
共705个文件
java:613个
html:54个
xml:10个
需积分: 0 6 下载量 48 浏览量
2009-04-09
15:51:27
上传
评论
收藏 4MB RAR 举报
温馨提示
JXSE_ProgGuide_v2.5(技术手册).pdf
资源详情
资源评论
资源推荐
收起资源包目录
jxse-src-2.5_rc2.rar (705个子文件)
net.jxta.document.Advertisement 745B
junit-LICENSE.html 15KB
jetty-LICENSE.html 7KB
package.html 4KB
package.html 3KB
package.html 2KB
package.html 2KB
package.html 1KB
package.html 1KB
overview.html 1KB
overview.html 1KB
package.html 994B
package.html 906B
package.html 847B
package.html 810B
package.html 724B
package.html 712B
package.html 707B
package.html 651B
package.html 626B
package.html 624B
package.html 609B
package.html 603B
package.html 588B
package.html 565B
package.html 552B
package.html 550B
package.html 539B
package.html 508B
package.html 506B
package.html 497B
package.html 481B
package.html 471B
package.html 467B
package.html 460B
package.html 457B
package.html 451B
package.html 449B
package.html 447B
package.html 426B
package.html 404B
package.html 400B
package.html 375B
package.html 359B
package.html 359B
package.html 357B
package.html 355B
package.html 342B
package.html 340B
package.html 313B
package.html 245B
package.html 236B
package.html 233B
package.html 222B
package.html 174B
net.jxta.id.ID 127B
bcprov-jdk14.jar 1.53MB
org.mortbay.jetty.jar 563KB
junit.jar 118KB
javax.servlet.jar 72KB
EndpointRouter.java 107KB
PeerView.java 73KB
EndpointServiceImpl.java 69KB
ConfigDialog.java 65KB
JxtaSocket.java 65KB
NetworkConfigurator.java 64KB
GenericPeerGroup.java 64KB
SwingUI.java 62KB
RelayServer.java 61KB
DiscoveryServiceImpl.java 58KB
LiteXMLElement.java 57KB
RouteResolver.java 55KB
RelayClient.java 55KB
Message.java 52KB
ResolverServiceImpl.java 52KB
IDFactory.java 50KB
JxtaBiDiPipe.java 48KB
Cm.java 46KB
TcpTransport.java 46KB
ReliableOutputStream.java 46KB
Paged.java 44KB
TransportBindingMetric.java 44KB
TcpMessenger.java 43KB
WireFormatMessageBinary.java 43KB
ProxyService.java 43KB
PipeResolver.java 42KB
PeerGroup.java 39KB
BTree.java 39KB
StdPeerGroup.java 38KB
HttpClientMessenger.java 38KB
HttpMessageServlet.java 37KB
ReliableTest.java 36KB
Messenger.java 36KB
JTlsOutputStream.java 35KB
BlockingMessenger.java 34KB
McastTransport.java 34KB
MonitorManager.java 34KB
RendezVousServiceProvider.java 33KB
EdgePeerRdvService.java 33KB
RelayConfigAdv.java 33KB
共 705 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
nnjjggmm
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Kepware.KEPServerEX.v4.264.401.Incl.Keygen-SSG
- 行人重识别-通过顺序决策实现跨域行人重识别算法-附项目源码-优质项目实战.zip
- HTML、CSS制作家乡介绍网页.zip
- 361050291.apk
- 华硕B250 PLUS支持6789代BIOS
- 基于javaScript开发的图书管理系统+数据库+源码+项目展示+开发文档(毕业设计&课程设计&项目开发)
- HTML+CSS制作的个人博客网页 2.zip
- 华硕B250M-PIXIU支持6789代BIOS
- c# winfrom 音量控制 静音
- 【OpenHarmony】 ArkTS 语法基础 ② ( ArkTS 自定义组件 )
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0