"RemoteException" 在 HDFS 中一般意味着什么?

What does "RemoteException" mean in general in HDFS?

1) 谁能帮我解释一下 "Remoteexception" 的概念?一般是什么意思?

2) unwrapRemoteException 又是什么意思?不确定 "if this remote exception wraps up one of the lookupTypes"

的意思
  /**
   * If this remote exception wraps up one of the lookupTypes
   * then return this exception.
   * <p>
   * Unwraps any IOException.
   * 
   * @param lookupTypes the desired exception class.
   * @return IOException, which is either the lookupClass exception or this.
   */
  public IOException unwrapRemoteException(Class<?>... lookupTypes) {
    if(lookupTypes == null)
      return this;
    for(Class<?> lookupClass : lookupTypes) {
      if(!lookupClass.getName().equals(getClassName()))
        continue;
      try {
        return instantiateException(lookupClass.asSubclass(IOException.class));
      } catch(Exception e) {
        // cannot instantiate lookupClass, just return this
        return this;
      }
    }
    // wrapped up exception is not in lookupTypes, just return this
    return this;
  }

(Hadoop_HDFS_Open_Source: https://github.com/apache/hadoop)

提前致谢!任何帮助将不胜感激!

1) May anyone help me about the concept of "Remoteexception"? What does it mean in general?

在服务器端抛出(创建)了远程异常。服务器抛出此类异常是因为客户端发送了无效请求,或者服务器有内部错误或其他原因。服务器端的 RPC 服务器序列化异常,并将其发送到客户端。客户端反序列化异常,得到异常

2) Also what does it mean by unwrapRemoteException?

问题是"why we need to wrap exception"。首先,RemoteException 是一个包装器而不是真正的异常。服务器抛出的真正异常可能是AccessControlException(用户没有权限),FileNotFoundException(无效请求)。我们将它们包装在 RemoteException 中。但为什么?因为代码更清晰,更具可读性。

Was not sure it means by "if this remote exception wraps up one of the lookupTypes"

例如,在DFSClient.java

public HdfsFileStatus getFileInfo(String src) throws IOException {
  checkOpen();
  try {
    return namenode.getFileInfo(src);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   FileNotFoundException.class,
                                   UnresolvedPathException.class);
  }
}

如果 re 包含一个 FileNotFoundException,那么 getFileInfo 只包含 returns FileNotFoundException。然后用户可以看到更短更清晰的异常消息。用户只需要知道文件没有找到,不关心远程与否。

但是如果 re 包装了一个 SafeModeException 或一些未知的异常。这可能是某些服务器的内部错误或配置错误。我们准确地抛出 re(RemoteException)。所以用户可以知道错误来自远程(服务器端),即使用户不知道包装的 SafeModeException(或一些未知的异常)。用户可以向技术支持寻求帮助。