org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos Java Examples

The following examples show how to use org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos. 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: PBHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static SafeModeAction convert(
    ClientNamenodeProtocolProtos.SafeModeActionProto a) {
  switch (a) {
  case SAFEMODE_LEAVE:
    return SafeModeAction.SAFEMODE_LEAVE;
  case SAFEMODE_ENTER:
    return SafeModeAction.SAFEMODE_ENTER;
  case SAFEMODE_GET:
    return SafeModeAction.SAFEMODE_GET;
  default:
    throw new IllegalArgumentException("Unexpected SafeModeAction :" + a);
  }
}
 
Example #2
Source File: ProxyServer.java    From nnproxy with Apache License 2.0 5 votes vote down vote up
public void start() throws IOException {
    int rpcHandlerCount = conf.getInt(ProxyConfig.PROXY_HANDLER_COUNT, ProxyConfig.PROXY_HANDLER_COUNT_DEFAULT);
    RPC.setProtocolEngine(conf, ClientNamenodeProtocolPB.class,
            ProtobufRpcEngine.class);
    RPC.setProtocolEngine(conf, NamenodeProtocolPB.class,
            ProtobufRpcEngine.class);

    this.protocol = (ClientProtocol) Proxy.newProxyInstance(
            this.getClass().getClassLoader(),
            new Class[]{ClientProtocol.class},
            this.invocationHandler);

    ClientNamenodeProtocolPB proxy = new ClientNamenodeProtocolServerSideTranslatorPB(this.protocol);
    BlockingService clientNNPbService = ClientNamenodeProtocolProtos.ClientNamenodeProtocol.
            newReflectiveBlockingService(proxy);

    int port = conf.getInt(ProxyConfig.RPC_PORT, ProxyConfig.RPC_PORT_DEFAULT);

    this.rpcServer = new RPC.Builder(conf)
            .setProtocol(org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB.class)
            .setInstance(clientNNPbService).setBindAddress("0.0.0.0")
            .setPort(port).setNumHandlers(rpcHandlerCount)
            .setVerbose(false).build();
    this.rpcServer.start();

    InetSocketAddress listenAddr = rpcServer.getListenerAddress();
    rpcAddress = new InetSocketAddress("0.0.0.0", listenAddr.getPort());
}
 
Example #3
Source File: PBHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static SafeModeAction convert(
    ClientNamenodeProtocolProtos.SafeModeActionProto a) {
  switch (a) {
  case SAFEMODE_LEAVE:
    return SafeModeAction.SAFEMODE_LEAVE;
  case SAFEMODE_ENTER:
    return SafeModeAction.SAFEMODE_ENTER;
  case SAFEMODE_GET:
    return SafeModeAction.SAFEMODE_GET;
  default:
    throw new IllegalArgumentException("Unexpected SafeModeAction :" + a);
  }
}