org.apache.hadoop.ipc.RemoteException.writeXml()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.apache.hadoop.ipc.RemoteException.writeXml方法的一些代码示例,展示了RemoteException.writeXml的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteException.writeXml方法的具体详情如下:
包路径:org.apache.hadoop.ipc.RemoteException
类名称:RemoteException
方法名:writeXml

RemoteException.writeXml介绍

[英]Write the object to XML format
[中]

代码示例

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

catch(RemoteException re) {re.writeXml(p, doc);}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

} catch(RemoteException re) {re.writeXml(p, doc);}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/** {@inheritDoc} */
 public void doGet(HttpServletRequest request, HttpServletResponse response
   ) throws ServletException, IOException {
  final UnixUserGroupInformation ugi = getUGI(request);
  final PrintWriter out = response.getWriter();
  final String filename = getFilename(request, response);
  final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
  xml.declaration();
  Configuration daemonConf = (Configuration) getServletContext()
   .getAttribute(HttpServer.CONF_CONTEXT_ATTRIBUTE);
  final Configuration conf = (daemonConf == null) ? new Configuration()
   : new Configuration(daemonConf);
  final int socketTimeout = conf.getInt("dfs.socket.timeout", HdfsConstants.READ_TIMEOUT);
  final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
  UnixUserGroupInformation.saveToConf(conf,
    UnixUserGroupInformation.UGI_PROPERTY_NAME, ugi);
  final ProtocolProxy<ClientProtocol> nnproxy =
   DFSClient.createRPCNamenode(conf);
  try {
   final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
     DataTransferProtocol.DATA_TRANSFER_VERSION,
     filename, nnproxy.getProxy(), nnproxy, socketFactory, socketTimeout);
   MD5MD5CRC32FileChecksum.write(xml, checksum);
  } catch(IOException ioe) {
   new RemoteException(ioe.getClass().getName(), ioe.getMessage()
     ).writeXml(filename, xml);
  }
  xml.endDocument();
 }
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

/** {@inheritDoc} */
 public void doGet(HttpServletRequest request, HttpServletResponse response
   ) throws ServletException, IOException {
  final UnixUserGroupInformation ugi = getUGI(request);
  final PrintWriter out = response.getWriter();
  final String filename = getFilename(request, response);
  final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
  xml.declaration();
  final Configuration conf = new Configuration(DataNode.getDataNode().getConf());
  final int socketTimeout = conf.getInt("dfs.socket.timeout", HdfsConstants.READ_TIMEOUT);
  final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
  UnixUserGroupInformation.saveToConf(conf,
    UnixUserGroupInformation.UGI_PROPERTY_NAME, ugi);
  final ClientProtocol nnproxy = DFSClient.createNamenode(conf);
  try {
   final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
     filename, nnproxy, socketFactory, socketTimeout);
   MD5MD5CRC32FileChecksum.write(xml, checksum);
  } catch(IOException ioe) {
   new RemoteException(ioe.getClass().getName(), ioe.getMessage()
     ).writeXml(filename, xml);
  }
  xml.endDocument();
 }
}

相关文章