RPC.java 文件源码

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

项目:hadoop-EAR 作者:
public Object invoke(Object proxy, Method method, Object[] args)
  throws Throwable {
  final boolean logDebug = !fastProtocol && LOG.isDebugEnabled();
  long startTime = 0;
  if (logDebug) {
    startTime = System.currentTimeMillis();
  }

  ObjectWritable value = null;
  try {
    String name = null;
    if (fastProtocol) {
      // try to obtain registered name for the method
      name = FastProtocolRegister.tryGetId(method);
    } 
    value = (ObjectWritable) client.call(new Invocation(method, name, args),
        getAddress(), protocol, ticket, rpcTimeout, fastProtocol);
  } catch (RemoteException re) {
    throw re;
  } catch (ConnectException ce) {
    needCheckDnsUpdate = true;
    throw ce;
  } catch (NoRouteToHostException nrhe) {
    needCheckDnsUpdate = true;
    throw nrhe;
  } catch (PortUnreachableException pue) {
    needCheckDnsUpdate = true;
    throw pue;
  } catch (UnknownHostException uhe) {
    needCheckDnsUpdate = true;
    throw uhe;
  } 
  if (logDebug) {
    long callTime = System.currentTimeMillis() - startTime;
    LOG.debug("Call: " + method.getName() + " " + callTime);
  }
  return value.get();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号