Java 类org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread 实例源码

项目:ditb    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:ditb    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:LCIndex-HBase-0.94.16    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:LCIndex-HBase-0.94.16    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:pbase    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:pbase    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:HIndex    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:HIndex    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:IRIndex    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:IRIndex    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:hbase    文件:TestClientClusterStatus.java   
@Test
public void testMasterAndBackupMastersStatus() throws Exception {
  // get all the master threads
  List<MasterThread> masterThreads = CLUSTER.getMasterThreads();
  int numActive = 0;
  int activeIndex = 0;
  ServerName activeName = null;
  HMaster active = null;
  for (int i = 0; i < masterThreads.size(); i++) {
    if (masterThreads.get(i).getMaster().isActiveMaster()) {
      numActive++;
      activeIndex = i;
      active = masterThreads.get(activeIndex).getMaster();
      activeName = active.getServerName();
    }
  }
  Assert.assertNotNull(active);
  Assert.assertEquals(1, numActive);
  Assert.assertEquals(MASTERS, masterThreads.size());
  // Retrieve master and backup masters infos only.
  EnumSet<Option> options = EnumSet.of(Option.MASTER, Option.BACKUP_MASTERS);
  ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
  Assert.assertTrue(status.getMaster().equals(activeName));
  Assert.assertEquals(MASTERS - 1, status.getBackupMastersSize());
}
项目:hbase    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
@Override
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:hbase    文件:MiniHBaseCluster.java   
/**
 * Do a simulated kill all masters and regionservers. Useful when it is
 * impossible to bring the mini-cluster back for clean shutdown.
 */
public void killAll() {
  // Do backups first.
  MasterThread activeMaster = null;
  for (MasterThread masterThread : getMasterThreads()) {
    if (!masterThread.getMaster().isActiveMaster()) {
      masterThread.getMaster().abort("killAll");
    } else {
      activeMaster = masterThread;
    }
  }
  // Do active after.
  if (activeMaster != null) {
    activeMaster.getMaster().abort("killAll");
  }
  for (RegionServerThread rst : getRegionServerThreads()) {
    rst.getRegionServer().abort("killAll");
  }
}
项目:hbase    文件:TestClientClusterMetrics.java   
@Test
public void testMasterAndBackupMastersStatus() throws Exception {
  // get all the master threads
  List<MasterThread> masterThreads = CLUSTER.getMasterThreads();
  int numActive = 0;
  int activeIndex = 0;
  ServerName activeName = null;
  HMaster active = null;
  for (int i = 0; i < masterThreads.size(); i++) {
    if (masterThreads.get(i).getMaster().isActiveMaster()) {
      numActive++;
      activeIndex = i;
      active = masterThreads.get(activeIndex).getMaster();
      activeName = active.getServerName();
    }
  }
  Assert.assertNotNull(active);
  Assert.assertEquals(1, numActive);
  Assert.assertEquals(MASTERS, masterThreads.size());
  // Retrieve master and backup masters infos only.
  EnumSet<Option> options = EnumSet.of(Option.MASTER, Option.BACKUP_MASTERS);
  ClusterMetrics metrics = ADMIN.getClusterMetrics(options);
  Assert.assertTrue(metrics.getMasterName().equals(activeName));
  Assert.assertEquals(MASTERS - 1, metrics.getBackupMasterNames().size());
}
项目:hbase    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:hbase    文件:TestShutdownBackupMaster.java   
@Test
public void testShutdownWhileBecomingActive() throws InterruptedException {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();
  HMaster activeMaster = null;
  HMaster backupMaster = null;
  for (MasterThread t : cluster.getMasterThreads()) {
    if (t.getMaster().isActiveMaster()) {
      activeMaster = t.getMaster();
    } else {
      backupMaster = t.getMaster();
    }
  }
  assertNotNull(activeMaster);
  assertNotNull(backupMaster);
  ARRIVE = new CountDownLatch(1);
  CONTINUE = new CountDownLatch(1);
  activeMaster.abort("Aborting active master for test");
  // wait until we arrive the initClusterSchemaService
  ARRIVE.await();
  // killall RSes
  cluster.getRegionServerThreads().stream().map(t -> t.getRegionServer())
      .forEachOrdered(rs -> rs.abort("Aborting RS for test"));
  CONTINUE.countDown();
}
项目:hbase    文件:TestRSKilledWhenInitializing.java   
/**
 * Start Master. Get as far as the state where Master is waiting on
 * RegionServers to check in, then return.
 */
private MasterThread startMaster(MasterThread master) {
  master.start();
  // It takes a while until ServerManager creation to happen inside Master startup.
  while (master.getMaster().getServerManager() == null) {
    continue;
  }
  // Set a listener for the waiting-on-RegionServers state. We want to wait
  // until this condition before we leave this method and start regionservers.
  final AtomicBoolean waiting = new AtomicBoolean(false);
  if (master.getMaster().getServerManager() == null) throw new NullPointerException("SM");
  master.getMaster().getServerManager().registerListener(new ServerListener() {
    @Override
    public void waiting() {
      waiting.set(true);
    }
  });
  // Wait until the Master gets to place where it is waiting on RegionServers to check in.
  while (!waiting.get()) {
    continue;
  }
  // Set the global master-is-active; gets picked up by regionservers later.
  masterActive.set(true);
  return master;
}
项目:PyroDB    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:PyroDB    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:c5    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:c5    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().isDeadServer(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:HBase-Research    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:HBase-Research    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:hbase-0.94.8-qod    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:hbase-0.94.8-qod    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:hbase-0.94.8-qod    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:hbase-0.94.8-qod    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:DominoHBase    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:DominoHBase    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:hindex    文件:MiniHBaseCluster.java   
/**
 * Blocks until there is an active master and that master has completed
 * initialization.
 *
 * @return true if an active master becomes available.  false if there are no
 *         masters left.
 * @throws InterruptedException
 */
public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
  List<JVMClusterUtil.MasterThread> mts;
  long start = System.currentTimeMillis();
  while (!(mts = getMasterThreads()).isEmpty()
      && (System.currentTimeMillis() - start) < timeout) {
    for (JVMClusterUtil.MasterThread mt : mts) {
      ServerManager serverManager = mt.getMaster().getServerManager();
      if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()
          && !serverManager.areDeadServersInProgress()) {
        return true;
      }
    }

    Threads.sleep(100);
  }
  return false;
}
项目:hindex    文件:TestRollingRestart.java   
private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
    ServerName serverName) throws InterruptedException {
  ServerManager sm = activeMaster.getMaster().getServerManager();
  // First wait for it to be in dead list
  while (!sm.getDeadServers().contains(serverName)) {
    log("Waiting for [" + serverName + "] to be listed as dead in master");
    Thread.sleep(1);
  }
  log("Server [" + serverName + "] marked as dead, waiting for it to " +
      "finish dead processing");
  while (sm.areDeadServersInProgress()) {
    log("Server [" + serverName + "] still being processed, waiting");
    Thread.sleep(100);
  }
  log("Server [" + serverName + "] done with server shutdown processing");
}
项目:ditb    文件:MiniHBaseCluster.java   
/**
 * Starts a master thread running
 *
 * @throws IOException
 * @return New RegionServerThread
 */
public JVMClusterUtil.MasterThread startMaster() throws IOException {
  Configuration c = HBaseConfiguration.create(conf);
  User user =
      HBaseTestingUtility.getDifferentUser(c, ".hfs."+index++);

  JVMClusterUtil.MasterThread t = null;
  try {
    t = hbaseCluster.addMaster(c, hbaseCluster.getMasters().size(), user);
    t.start();
  } catch (InterruptedException ie) {
    throw new IOException("Interrupted adding master to cluster", ie);
  }
  return t;
}
项目:ditb    文件:MiniHBaseCluster.java   
/**
 * Returns the current active master thread, if available.
 * @return the active MasterThread, null if none is active.
 */
public MasterThread getMasterThread() {
  for (MasterThread mt: hbaseCluster.getLiveMasters()) {
    if (mt.getMaster().isActiveMaster()) {
      return mt;
    }
  }
  return null;
}
项目:ditb    文件:MiniHBaseCluster.java   
/**
 * Counts the total numbers of regions being served by the currently online
 * region servers by asking each how many regions they have.  Does not look
 * at hbase:meta at all.  Count includes catalog tables.
 * @return number of regions being served by all region servers
 */
public long countServedRegions() {
  long count = 0;
  for (JVMClusterUtil.RegionServerThread rst : getLiveRegionServerThreads()) {
    count += rst.getRegionServer().getNumberOfOnlineRegions();
  }
  for (JVMClusterUtil.MasterThread mt : getLiveMasterThreads()) {
    count += mt.getMaster().getNumberOfOnlineRegions();
  }
  return count;
}
项目:ditb    文件:MiniHBaseCluster.java   
/**
 * Do a simulated kill all masters and regionservers. Useful when it is
 * impossible to bring the mini-cluster back for clean shutdown.
 */
public void killAll() {
  for (RegionServerThread rst : getRegionServerThreads()) {
    rst.getRegionServer().abort("killAll");
  }
  for (MasterThread masterThread : getMasterThreads()) {
    masterThread.getMaster().abort("killAll", new Throwable());
  }
}
项目:ditb    文件:MiniHBaseCluster.java   
protected int getMasterIndex(ServerName serverName) {
  List<MasterThread> masters = getMasterThreads();
  for (int i = 0; i < masters.size(); i++) {
    if (masters.get(i).getMaster().getServerName().equals(serverName)) {
      return i;
    }
  }
  return -1;
}
项目:ditb    文件:HBaseTestingUtility.java   
private void decrementMinRegionServerCount() {
  // decrement the count for this.conf, for newly spwaned master
  // this.hbaseCluster shares this configuration too
  decrementMinRegionServerCount(getConfiguration());

  // each master thread keeps a copy of configuration
  for (MasterThread master : getHBaseCluster().getMasterThreads()) {
    decrementMinRegionServerCount(master.getMaster().getConfiguration());
  }
}
项目:ditb    文件:TestRollingRestart.java   
private int getNumberOfOnlineRegions(MiniHBaseCluster cluster) {
  int numFound = 0;
  for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) {
    numFound += rst.getRegionServer().getNumberOfOnlineRegions();
  }
  for (MasterThread mt : cluster.getMasterThreads()) {
    numFound += mt.getMaster().getNumberOfOnlineRegions();
  }
  return numFound;
}
项目:ditb    文件:TestRegionServerReportForDuty.java   
private void waitForClusterOnline(MasterThread master) throws InterruptedException {
  while (true) {
    if (master.getMaster().isInitialized()) {
      break;
    }
    Thread.sleep(SLEEP_INTERVAL);
    LOG.debug("Waiting for master to come online ...");
  }
  rs.waitForServerOnline();
}
项目:LCIndex-HBase-0.94.16    文件:MiniHBaseCluster.java   
/**
 * Starts a master thread running
 *
 * @throws IOException
 * @return New RegionServerThread
 */
public JVMClusterUtil.MasterThread startMaster() throws IOException {
  Configuration c = HBaseConfiguration.create(conf);
  User user =
      HBaseTestingUtility.getDifferentUser(c, ".hfs."+index++);

  JVMClusterUtil.MasterThread t = null;
  try {
    t = hbaseCluster.addMaster(c, hbaseCluster.getMasters().size(), user);
    t.start();
  } catch (InterruptedException ie) {
    throw new IOException("Interrupted adding master to cluster", ie);
  }
  return t;
}