ConnectionManager.java 文件源码

java
阅读 74 收藏 0 点赞 0 评论 0

项目:ditb 作者:
@Override
// Nothing is done w/ the 'master' parameter.  It is ignored.
public AdminService.BlockingInterface getAdmin(final ServerName serverName,
  final boolean master)
throws IOException {
  if (isDeadServer(serverName)) {
    throw new RegionServerStoppedException(serverName + " is dead.");
  }
  String key = getStubKey(AdminService.BlockingInterface.class.getName(),
      serverName.getHostname(), serverName.getPort(), this.hostnamesCanChange);
  this.connectionLock.putIfAbsent(key, key);
  AdminService.BlockingInterface stub = null;
  synchronized (this.connectionLock.get(key)) {
    stub = (AdminService.BlockingInterface)this.stubs.get(key);
    if (stub == null) {
      BlockingRpcChannel channel =
          this.rpcClient.createBlockingRpcChannel(serverName, user, rpcTimeout);
      stub = AdminService.newBlockingStub(channel);
      this.stubs.put(key, stub);
    }
  }
  return stub;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号