一、每次发起一次RPC调用,就创建一个Future对象,并将对象放入集合中
//存放channel对象
private static final Map<Long, Channel> CHANNELS = new ConcurrentHashMap<Long, Channel>();
//存放Future对象
private static final Map<Long, DefaultFuture> FUTURES = new ConcurrentHashMap<Long, DefaultFuture>();
private final Lock lock = new ReentrantLock();
private final Condition done = lock.newCondition();
//开始循环扫描线程
static {
Thread th = new Thread(new RemotingInvocationTimeoutScan(),
"DubboResponseTimeoutScanTimer");
th.setDaemon(true);
th.start();
}
//创建Future对象
public DefaultFuture(Channel channel, Request request, int timeout) {
this.channel = channel;
this.request = request;
this.id = request.getId();
this.timeout = timeout > 0 ? timeout : channel.getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
// put into w


3290

被折叠的 条评论
为什么被折叠?



