RPC.java 文件源码

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

项目:hortonworks-extension 作者:
/**
 * Construct & cache an IPC client with the user-provided SocketFactory 
 * if no cached client exists.
 * 
 * @param conf Configuration
 * @return an IPC client
 */
private synchronized Client getClient(Configuration conf,
    SocketFactory factory) {
  // Construct & cache client.  The configuration is only used for timeout,
  // and Clients have connection pools.  So we can either (a) lose some
  // connection pooling and leak sockets, or (b) use the same timeout for all
  // configurations.  Since the IPC is usually intended globally, not
  // per-job, we choose (a).
  Client client = clients.get(factory);
  if (client == null) {
    client = new Client(ObjectWritable.class, conf, factory);
    clients.put(factory, client);
  } else {
    client.incCount();
  }
  return client;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号