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

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

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

RPC.getServerAddress介绍

[英]Returns the server address for a given proxy.
[中]返回给定代理的服务器地址。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

InetSocketAddress serverAddress = RPC.getServerAddress(rpcProxy);
Map<Long, ProtocolSignature> versionMap = getVersionSignatureMap(
  serverAddress, protocol.getName(), rpcKind.toString());

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

/**
 * Get the internet address of the currently-active NN. This should rarely be
 * used, since callers of this method who connect directly to the NN using the
 * resulting InetSocketAddress will not be able to connect to the active NN if
 * a failover were to occur after this method has been called.
 * 
 * @param fs the file system to get the active address of.
 * @return the internet address of the currently-active NN.
 * @throws IOException if an error occurs while resolving the active NN.
 */
public static InetSocketAddress getAddressOfActive(FileSystem fs)
  throws IOException {
 if (!(fs instanceof DistributedFileSystem)) {
  throw new IllegalArgumentException("FileSystem " + fs + " is not a DFS.");
 }
 // force client address resolution.
 fs.exists(new Path("/"));
 DistributedFileSystem dfs = (DistributedFileSystem) fs;
 DFSClient dfsClient = dfs.getClient();
 return RPC.getServerAddress(dfsClient.getNamenode());
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-common

@Override
public InetSocketAddress getConnectAddress() {
 return RPC.getServerAddress(proxy);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-common

@Override
public InetSocketAddress getConnectAddress() {
 return RPC.getServerAddress(proxy);
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-common

@Override
public InetSocketAddress getConnectAddress() {
 return RPC.getServerAddress(proxy);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-common

@Override
public InetSocketAddress getConnectAddress() {
 return RPC.getServerAddress(proxy);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Get the internet address of the currently-active NN. This should rarely be
 * used, since callers of this method who connect directly to the NN using the
 * resulting InetSocketAddress will not be able to connect to the active NN if
 * a failover were to occur after this method has been called.
 * 
 * @param fs the file system to get the active address of.
 * @return the internet address of the currently-active NN.
 * @throws IOException if an error occurs while resolving the active NN.
 */
public static InetSocketAddress getAddressOfActive(FileSystem fs)
  throws IOException {
 if (!(fs instanceof DistributedFileSystem)) {
  throw new IllegalArgumentException("FileSystem " + fs + " is not a DFS.");
 }
 // force client address resolution.
 fs.exists(new Path("/"));
 DistributedFileSystem dfs = (DistributedFileSystem) fs;
 DFSClient dfsClient = dfs.getClient();
 return RPC.getServerAddress(dfsClient.getNamenode());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

/**
 * Get the internet address of the currently-active NN. This should rarely be
 * used, since callers of this method who connect directly to the NN using the
 * resulting InetSocketAddress will not be able to connect to the active NN if
 * a failover were to occur after this method has been called.
 * 
 * @param fs the file system to get the active address of.
 * @return the internet address of the currently-active NN.
 * @throws IOException if an error occurs while resolving the active NN.
 */
public static InetSocketAddress getAddressOfActive(FileSystem fs)
  throws IOException {
 if (!(fs instanceof DistributedFileSystem)) {
  throw new IllegalArgumentException("FileSystem " + fs + " is not a DFS.");
 }
 // force client address resolution.
 fs.exists(new Path("/"));
 DistributedFileSystem dfs = (DistributedFileSystem) fs;
 DFSClient dfsClient = dfs.getClient();
 return RPC.getServerAddress(dfsClient.getNamenode());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

InetSocketAddress serverAddress = RPC.getServerAddress(rpcProxy);
Map<Long, ProtocolSignature> versionMap = getVersionSignatureMap(
  serverAddress, protocol.getName(), rpcKind.toString());

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

InetSocketAddress serverAddress = RPC.getServerAddress(rpcProxy);
Map<Long, ProtocolSignature> versionMap = getVersionSignatureMap(
  serverAddress, protocol.getName(), rpcKind.toString());

代码示例来源:origin: io.hops/hadoop-common

InetSocketAddress serverAddress = RPC.getServerAddress(rpcProxy);
Map<Long, ProtocolSignature> versionMap = getVersionSignatureMap(
  serverAddress, protocol.getName(), rpcKind.toString());

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

InetSocketAddress serverAddress = RPC.getServerAddress(rpcProxy);
Map<Long, ProtocolSignature> versionMap = getVersionSignatureMap(
  serverAddress, protocol.getName(), rpcKind.toString());

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testProxyAddress() throws IOException {
 Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
   .setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0).build();
 TestProtocol proxy = null;
 
 try {
  server.start();
  InetSocketAddress addr = NetUtils.getConnectAddress(server);
  // create a client
  proxy = RPC.getProxy(TestProtocol.class, TestProtocol.versionID, addr, conf);
  
  assertEquals(addr, RPC.getServerAddress(proxy));
 } finally {
  server.stop();
  if (proxy != null) {
   RPC.stopProxy(proxy);
  }
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testProxyAddress() throws IOException {
 Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
   .setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0).build();
 TestProtocol proxy = null;
 
 try {
  server.start();
  InetSocketAddress addr = NetUtils.getConnectAddress(server);
  // create a client
  proxy = RPC.getProxy(TestProtocol.class, TestProtocol.versionID, addr, conf);
  
  assertEquals(addr, RPC.getServerAddress(proxy));
 } finally {
  server.stop();
  if (proxy != null) {
   RPC.stopProxy(proxy);
  }
 }
}

相关文章