Java Code Examples for org.apache.hadoop.ipc.RPC#getServerAddress()

The following examples show how to use org.apache.hadoop.ipc.RPC#getServerAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HAUtil.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 2
Source File: HAUtil.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 3
Source File: MRClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public InetSocketAddress getConnectAddress() {
  return RPC.getServerAddress(proxy);
}
 
Example 4
Source File: MRClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public InetSocketAddress getConnectAddress() {
  return RPC.getServerAddress(proxy);
}