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

项目: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);
  }
}
项目:ditb    文件:ProtobufUtil.java   
/**
 * Convert SecurityCapabilitiesResponse.Capability to SecurityCapability
 * @param capabilities capabilities returned in the SecurityCapabilitiesResponse message
 * @return the converted list of SecurityCapability elements
 */
public static List<SecurityCapability> toSecurityCapabilityList(
    List<MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities) {
  List<SecurityCapability> scList = new ArrayList<>(capabilities.size());
  for (MasterProtos.SecurityCapabilitiesResponse.Capability c: capabilities) {
    try {
      scList.add(SecurityCapability.valueOf(c.getNumber()));
    } catch (IllegalArgumentException e) {
      // Unknown capability, just ignore it. We don't understand the new capability
      // but don't care since by definition we cannot take advantage of it.
    }
  }
  return scList;
}
项目:HIndex    文件:HMaster.java   
/**
 * @return list of blocking services and their security info classes that this server supports
 */
private List<BlockingServiceAndInterface> getServices() {
  List<BlockingServiceAndInterface> bssi = new ArrayList<BlockingServiceAndInterface>(3);
  bssi.add(new BlockingServiceAndInterface(
      MasterProtos.MasterService.newReflectiveBlockingService(this),
      MasterProtos.MasterService.BlockingInterface.class));
  bssi.add(new BlockingServiceAndInterface(
      RegionServerStatusProtos.RegionServerStatusService.newReflectiveBlockingService(this),
      RegionServerStatusProtos.RegionServerStatusService.BlockingInterface.class));
  return bssi;
}
项目:c5    文件:HMaster.java   
/**
 * @return list of blocking services and their security info classes that this server supports
 */
private List<BlockingServiceAndInterface> getServices() {
  List<BlockingServiceAndInterface> bssi = new ArrayList<BlockingServiceAndInterface>(3);
  bssi.add(new BlockingServiceAndInterface(
      MasterProtos.MasterService.newReflectiveBlockingService(this),
      MasterProtos.MasterService.BlockingInterface.class));
  bssi.add(new BlockingServiceAndInterface(
      RegionServerStatusProtos.RegionServerStatusService.newReflectiveBlockingService(this),
      RegionServerStatusProtos.RegionServerStatusService.BlockingInterface.class));
  return bssi;
}
项目:aliyun-tablestore-hbase-client    文件:TablestoreAdmin.java   
@Override
public MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot) throws IOException {
    throw new UnsupportedOperationException("takeSnapshotAsync");
}
项目:cloud-bigtable-client    文件:BigtableAdmin.java   
@Override
public MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot)
    throws IOException, SnapshotCreationException {
  throw new UnsupportedOperationException("takeSnapshotAsync");  // TODO
}
项目: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    文件: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();
  }
}
项目:CSBT    文件:CrossSiteHBaseAdmin.java   
/**
 * Unsupported.
 */
public MasterProtos.SnapshotResponse takeSnapshotAsync(SnapshotDescription snapshot) throws IOException,
    SnapshotCreationException {
  throw new UnsupportedOperationException();
}
项目: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    文件: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();
  }
}
项目:ditb    文件:Admin.java   
/**
 * Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a
 * single snapshot should be taken at a time, or results may be undefined.
 *
 * @param snapshot snapshot to take
 * @return response from the server indicating the max time to wait for the snapshot
 * @throws IOException if the snapshot did not succeed or we lose contact with the master.
 * @throws SnapshotCreationException if snapshot creation failed
 * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
 */
MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot)
    throws IOException, SnapshotCreationException;
项目:pbase    文件:Admin.java   
/**
 * Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a
 * single snapshot should be taken at a time, or results may be undefined.
 *
 * @param snapshot snapshot to take
 * @return response from the server indicating the max time to wait for the snapshot
 * @throws IOException if the snapshot did not succeed or we lose contact with the master.
 * @throws SnapshotCreationException if snapshot creation failed
 * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
 */
MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot)
    throws IOException, SnapshotCreationException;
项目:PyroDB    文件:Admin.java   
/**
 * Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a
 * single snapshot should be taken at a time, or results may be undefined.
 *
 * @param snapshot snapshot to take
 * @return response from the server indicating the max time to wait for the snapshot
 * @throws IOException if the snapshot did not succeed or we lose contact with the master.
 * @throws SnapshotCreationException if snapshot creation failed
 * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
 */
MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot)
    throws IOException, SnapshotCreationException;