Java 类org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningRequest 实例源码

项目:ditb    文件:MasterRpcServices.java   
@Override
public IsMasterRunningResponse isMasterRunning(RpcController c,
    IsMasterRunningRequest req) throws ServiceException {
  try {
    master.checkServiceStarted();
    return IsMasterRunningResponse.newBuilder().setIsMasterRunning(
      !master.isStopped()).build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:ditb    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws IOException, InterruptedException, KeeperException {
  ServerName sm = master.getServerName();
  boolean fakeZNodeDelete = false;
  for (int i = 0; i < 20; i++) {
    try {
      BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
      MasterProtos.MasterService.BlockingInterface stub =
          MasterProtos.MasterService.newBlockingStub(channel);
      assertTrue(stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance())
          .getIsMasterRunning());
      return;
    } catch (ServiceException ex) {
      IOException ie = ProtobufUtil.getRemoteException(ex);
      // No SocketTimeoutException here. RpcServer is already started after the construction of
      // HMaster.
      assertTrue(ie.getMessage().startsWith(
        "org.apache.hadoop.hbase.ipc.ServerNotRunningYetException: Server is not running yet"));
      LOG.info("Expected exception: ", ie);
      if (!fakeZNodeDelete) {
        testUtil.getZooKeeperWatcher().getRecoverableZooKeeper()
            .delete(testUtil.getZooKeeperWatcher().getMasterAddressZNode(), -1);
        fakeZNodeDelete = true;
      }
    }
    Thread.sleep(1000);
  }
}
项目:pbase    文件:MasterRpcServices.java   
@Override
public IsMasterRunningResponse isMasterRunning(RpcController c,
    IsMasterRunningRequest req) throws ServiceException {
  try {
    master.checkServiceStarted();
    return IsMasterRunningResponse.newBuilder().setIsMasterRunning(
      !master.isStopped()).build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:PyroDB    文件:MasterRpcServices.java   
@Override
public IsMasterRunningResponse isMasterRunning(RpcController c,
    IsMasterRunningRequest req) throws ServiceException {
  try {
    master.checkInitialized();
    return IsMasterRunningResponse.newBuilder().setIsMasterRunning(
      !master.isStopped()).build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:DominoHBase    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws Exception {
  HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.MASTER_PORT, "0");

  HMaster hm = new HMaster(conf);

  ServerName sm = hm.getServerName();
  InetSocketAddress isa = new InetSocketAddress(sm.getHostname(), sm.getPort());
  int i = 0;
  //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
  //try to connect too soon. Retry on SocketTimeoutException.
  while (i < 20) { 
    try {
      MasterMonitorProtocol inf = (MasterMonitorProtocol) HBaseClientRPC.getProxy(
          MasterMonitorProtocol.class, isa, conf, 100 * 10);
      inf.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
      fail();
    } catch (ServiceException ex) {
      IOException ie = ProtobufUtil.getRemoteException(ex);
      if (!(ie instanceof SocketTimeoutException)) {
        if(ie.getMessage().startsWith(
            "org.apache.hadoop.hbase.ipc.ServerNotRunningYetException: Server is not running yet")) {
          return;
        }
      } else {
        System.err.println("Got SocketTimeoutException. Will retry. ");
      }
    } catch (Throwable t) {
      fail("Unexpected throwable: " + t);
    }
    Thread.sleep(100);
    i++;
  }
  fail();
}
项目:pbase    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws Exception {
  HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.MASTER_PORT, "0");
  CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
  HMaster hm = new HMaster(conf, cp);
  ServerName sm = hm.getServerName();
  RpcClient rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    int i = 0;
    //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
    //try to connect too soon. Retry on SocketTimeoutException.
    while (i < 20) {
      try {
        BlockingRpcChannel channel =
          rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
        MasterProtos.MasterService.BlockingInterface stub =
          MasterProtos.MasterService.newBlockingStub(channel);
        stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
        fail();
      } catch (ServiceException ex) {
        IOException ie = ProtobufUtil.getRemoteException(ex);
        if (!(ie instanceof SocketTimeoutException)) {
          if (ie.getMessage().startsWith("org.apache.hadoop.hbase.ipc." +
              "ServerNotRunningYetException: Server is not running yet")) {
            // Done.  Got the exception we wanted.
            System.out.println("Expected exception: " + ie.getMessage());
            return;
          } else {
            throw ex;
          }
        } else {
          System.err.println("Got SocketTimeoutException. Will retry. ");
        }
      } catch (Throwable t) {
        fail("Unexpected throwable: " + t);
      }
      Thread.sleep(100);
      i++;
    }
    fail();
  } finally {
    rpcClient.close();
  }
}
项目:HIndex    文件:HMaster.java   
@Override
public IsMasterRunningResponse isMasterRunning(RpcController c, IsMasterRunningRequest req)
throws ServiceException {
  return IsMasterRunningResponse.newBuilder().setIsMasterRunning(isMasterRunning()).build();
}
项目:HIndex    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws Exception {
  HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.MASTER_PORT, "0");
  HMaster hm = new HMaster(conf);
  ServerName sm = hm.getServerName();
  RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    int i = 0;
    //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
    //try to connect too soon. Retry on SocketTimeoutException.
    while (i < 20) {
      try {
        BlockingRpcChannel channel =
          rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
        MasterProtos.MasterService.BlockingInterface stub =
          MasterProtos.MasterService.newBlockingStub(channel);
        stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
        fail();
      } catch (ServiceException ex) {
        IOException ie = ProtobufUtil.getRemoteException(ex);
        if (!(ie instanceof SocketTimeoutException)) {
          if (ie.getMessage().startsWith("org.apache.hadoop.hbase.ipc." +
              "ServerNotRunningYetException: Server is not running yet")) {
            // Done.  Got the exception we wanted.
            System.out.println("Expected exception: " + ie.getMessage());
            return;
          } else {
            throw ex;
          }
        } else {
          System.err.println("Got SocketTimeoutException. Will retry. ");
        }
      } catch (Throwable t) {
        fail("Unexpected throwable: " + t);
      }
      Thread.sleep(100);
      i++;
    }
    fail();
  } finally {
    rpcClient.stop();
  }
}
项目:PyroDB    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws Exception {
  HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.MASTER_PORT, "0");
  CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
  HMaster hm = new HMaster(conf, cp);
  ServerName sm = hm.getServerName();
  RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    int i = 0;
    //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
    //try to connect too soon. Retry on SocketTimeoutException.
    while (i < 20) {
      try {
        BlockingRpcChannel channel =
          rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
        MasterProtos.MasterService.BlockingInterface stub =
          MasterProtos.MasterService.newBlockingStub(channel);
        stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
        fail();
      } catch (ServiceException ex) {
        IOException ie = ProtobufUtil.getRemoteException(ex);
        if (!(ie instanceof SocketTimeoutException)) {
          if (ie.getMessage().startsWith("org.apache.hadoop.hbase.ipc." +
              "ServerNotRunningYetException: Server is not running yet")) {
            // Done.  Got the exception we wanted.
            System.out.println("Expected exception: " + ie.getMessage());
            return;
          } else {
            throw ex;
          }
        } else {
          System.err.println("Got SocketTimeoutException. Will retry. ");
        }
      } catch (Throwable t) {
        fail("Unexpected throwable: " + t);
      }
      Thread.sleep(100);
      i++;
    }
    fail();
  } finally {
    rpcClient.stop();
  }
}
项目:c5    文件:HMaster.java   
@Override
public IsMasterRunningResponse isMasterRunning(RpcController c, IsMasterRunningRequest req)
throws ServiceException {
  return IsMasterRunningResponse.newBuilder().setIsMasterRunning(isMasterRunning()).build();
}
项目:c5    文件:TestHMasterRPCException.java   
@Test
public void testRPCException() throws Exception {
  HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.MASTER_PORT, "0");
  HMaster hm = new HMaster(conf);
  ServerName sm = hm.getServerName();
  RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    int i = 0;
    //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
    //try to connect too soon. Retry on SocketTimeoutException.
    while (i < 20) {
      try {
        BlockingRpcChannel channel =
          rpcClient.createBlockingRpcChannel(sm, User.getCurrent(), 0);
        MasterProtos.MasterService.BlockingInterface stub =
          MasterProtos.MasterService.newBlockingStub(channel);
        stub.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
        fail();
      } catch (ServiceException ex) {
        IOException ie = ProtobufUtil.getRemoteException(ex);
        if (!(ie instanceof SocketTimeoutException)) {
          if (ie.getMessage().startsWith("org.apache.hadoop.hbase.ipc." +
              "ServerNotRunningYetException: Server is not running yet")) {
            // Done.  Got the exception we wanted.
            System.out.println("Expected exception: " + ie.getMessage());
            return;
          } else {
            throw ex;
          }
        } else {
          System.err.println("Got SocketTimeoutException. Will retry. ");
        }
      } catch (Throwable t) {
        fail("Unexpected throwable: " + t);
      }
      Thread.sleep(100);
      i++;
    }
    fail();
  } finally {
    rpcClient.stop();
  }
}
项目:DominoHBase    文件:HMaster.java   
public IsMasterRunningResponse isMasterRunning(RpcController c, IsMasterRunningRequest req)
throws ServiceException {
  return IsMasterRunningResponse.newBuilder().setIsMasterRunning(isMasterRunning()).build();
}
项目:ditb    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}
项目:pbase    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}
项目:HIndex    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}
项目:PyroDB    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}
项目:c5    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}
项目:DominoHBase    文件:RequestConverter.java   
/**
 * Creates a protocol buffer IsMasterRunningRequest
 *
 * @return a IsMasterRunningRequest
 */
public static IsMasterRunningRequest buildIsMasterRunningRequest() {
  return IsMasterRunningRequest.newBuilder().build();
}