Java Code Examples for org.apache.hadoop.ipc.RPC#VersionMismatch

The following examples show how to use org.apache.hadoop.ipc.RPC#VersionMismatch . 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: AvatarShell.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * main() has some simple utility methods
 */
public static void main(String argv[]) throws Exception {
  AvatarShell shell = null;
  try {
    shell = new AvatarShell();
  } catch (RPC.VersionMismatch v) {
    System.err.println("Version Mismatch between client and server"
        + "... command aborted.");
    System.exit(-1);
  } catch (IOException e) {
    System.err.println("Bad connection to AvatarNode. command aborted.");
    System.exit(-1);
  }

  int res;
  try {
    res = ToolRunner.run(shell, argv);
  } finally {
    shell.close();
  }
  System.exit(res);
}
 
Example 2
Source File: UtilizationShell.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public static void main(String[] argv) throws Exception {
  UtilizationShell shell = null;
  try {
    shell = new UtilizationShell(new Configuration());
  } catch (RPC.VersionMismatch v) {
    System.err.println("Version Mismatch between client and server" +
                       "... command aborted.");
    System.exit(-1);
  } catch (IOException e) {
    System.err.println("Bad connection to Collector. command aborted.");
    System.exit(-1);
  }

  int res;
  try {
    res = ToolRunner.run(shell, argv);
  } finally {
    shell.close();
  }
  System.exit(res);
}
 
Example 3
Source File: FairSchedulerShell.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public static void main(String argv[]) throws Exception {
  FairSchedulerShell shell = null;
  try {
    shell = new FairSchedulerShell();
    int res = ToolRunner.run(shell, argv);
    System.exit(res);
  } catch (RPC.VersionMismatch v) {
    System.err.println("Version Mismatch between client and server" +
                       "... command aborted.");
    System.exit(-1);
  } catch (IOException e) {
    System.err.
      println("Bad connection to FairScheduler. command aborted.");
    System.err.println(e.getMessage());
    System.exit(-1);
  }
}
 
Example 4
Source File: DFSClient.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Create a NameNode proxy for the client if the client and NameNode
 * are compatible
 *
 * @param nameNodeAddr NameNode address
 * @param conf configuration
 * @param ugi ticket
 * @return a NameNode proxy that's compatible with the client
 */
private void createRPCNamenodeIfCompatible(
    InetSocketAddress nameNodeAddr,
    Configuration conf,
    UnixUserGroupInformation ugi) throws IOException {
  try {
    this.namenodeProtocolProxy = createRPCNamenode(nameNodeAddr, conf, ugi);
    this.rpcNamenode = namenodeProtocolProxy.getProxy();
  } catch (RPC.VersionMismatch e) {
    long clientVersion = e.getClientVersion();
    namenodeVersion = e.getServerVersion();
    if (clientVersion > namenodeVersion &&
        !ProtocolCompatible.isCompatibleClientProtocol(
            clientVersion, namenodeVersion)) {
      throw new RPC.VersionIncompatible(
          ClientProtocol.class.getName(), clientVersion, namenodeVersion);
    }
    this.rpcNamenode = (ClientProtocol)e.getProxy();
  }
}
 
Example 5
Source File: FileFixer.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Setup a session with the specified datanode
 */
static ClientDatanodeProtocol createClientDatanodeProtocolProxy (
    DatanodeInfo datanodeid, Configuration conf) throws IOException {
  InetSocketAddress addr = NetUtils.createSocketAddr(
    datanodeid.getHost() + ":" + datanodeid.getIpcPort());
  if (ClientDatanodeProtocol.LOG.isDebugEnabled()) {
    ClientDatanodeProtocol.LOG.info("ClientDatanodeProtocol addr=" + addr);
  }
  try {
    return (ClientDatanodeProtocol)RPC.getProxy(ClientDatanodeProtocol.class,
      ClientDatanodeProtocol.versionID, addr, conf);
  } catch (RPC.VersionMismatch e) {
    long clientVersion = e.getClientVersion();
    long datanodeVersion = e.getServerVersion();
    if (clientVersion > datanodeVersion &&
        !ProtocolCompatible.isCompatibleClientDatanodeProtocol(
            clientVersion, datanodeVersion)) {
      throw new RPC.VersionIncompatible(
          ClientDatanodeProtocol.class.getName(), clientVersion, datanodeVersion);
    }
    return (ClientDatanodeProtocol)e.getProxy();
  }
}