当前位置: 首页>>代码示例>>Java>>正文


Java JVMClusterUtil.MasterThread方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread方法的典型用法代码示例。如果您正苦于以下问题:Java JVMClusterUtil.MasterThread方法的具体用法?Java JVMClusterUtil.MasterThread怎么用?Java JVMClusterUtil.MasterThread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.JVMClusterUtil的用法示例。


在下文中一共展示了JVMClusterUtil.MasterThread方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
public JVMClusterUtil.MasterThread addMaster(Configuration c, final int index)
throws IOException {
  // Create each master with its own Configuration instance so each has
  // its HConnection instance rather than share (see HBASE_INSTANCES down in
  // the guts of HConnectionManager.

  // Also, create separate CoordinatedStateManager instance per Server.
  // This is special case when we have to have more than 1 CoordinatedStateManager
  // within 1 process.
  CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);

  JVMClusterUtil.MasterThread mt = JVMClusterUtil.createMasterThread(c, cp,
      (Class<? extends HMaster>) conf.getClass(HConstants.MASTER_IMPL, this.masterClass), index);
  this.masterThreads.add(mt);
  return mt;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:LocalHBaseCluster.java

示例2: waitOnMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * Wait for the specified master to stop
 * Removes this thread from list of running threads.
 * @param masterThread
 * @return Name of master that just went down.
 */
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
  while (masterThread.isAlive()) {
    try {
      LOG.info("Waiting on " +
        masterThread.getMaster().getServerName().toString());
      masterThread.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
  for (int i=0;i<masterThreads.size();i++) {
    if (masterThreads.get(i) == masterThread) {
      masterThreads.remove(i);
      break;
    }
  }
  return masterThread.getName();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:LocalHBaseCluster.java

示例3: waitForActiveAndReadyMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:MiniHBaseCluster.java

示例4: getActiveMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * Gets the current active master, if available.  If no active master, returns
 * null.
 * @return the HMaster for the active master
 */
public HMaster getActiveMaster() {
  for (JVMClusterUtil.MasterThread mt : masterThreads) {
    if (mt.getMaster().isActiveMaster()) {
      // Ensure that the current active master is not stopped.
      // We don't want to return a stopping master as an active master.
      if (mt.getMaster().isActiveMaster()  && !mt.getMaster().isStopped()) {
        return mt.getMaster();
      }
    }
  }
  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:LocalHBaseCluster.java

示例5: getLiveMasters

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * @return List of running master servers (Some servers may have been killed
 * or aborted during lifetime of cluster; these servers are not included in
 * this list).
 */
public List<JVMClusterUtil.MasterThread> getLiveMasters() {
  List<JVMClusterUtil.MasterThread> liveServers =
    new ArrayList<JVMClusterUtil.MasterThread>();
  List<JVMClusterUtil.MasterThread> list = getMasters();
  for (JVMClusterUtil.MasterThread mt: list) {
    if (mt.isAlive()) {
      liveServers.add(mt);
    }
  }
  return liveServers;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:LocalHBaseCluster.java

示例6: waitOnMasterThreads

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{
  List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
  List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();

  if (masters != null) {
    for (JVMClusterUtil.MasterThread t : masters) {
      t.join();
      if(t.getMaster().isAborted()) {
        closeAllRegionServerThreads(regionservers);
        throw new RuntimeException("HMaster Aborted");
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:HMasterCommandLine.java

示例7: startMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:MiniHBaseCluster.java

示例8: countServedRegions

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:MiniHBaseCluster.java

示例9: getActiveMasterIndex

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * return the index of the active master in the cluster
 *
 * @throws org.apache.hadoop.hbase.MasterNotRunningException
 *          if no active master found
 */
private int getActiveMasterIndex(MiniHBaseCluster cluster) throws MasterNotRunningException {
  // get all the master threads
  List<JVMClusterUtil.MasterThread> masterThreads = cluster.getMasterThreads();

  for (int i = 0; i < masterThreads.size(); i++) {
    if (masterThreads.get(i).getMaster().isActiveMaster()) {
      return i;
    }
  }
  throw new MasterNotRunningException();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestMasterFailoverBalancerPersistence.java

示例10: addMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
public JVMClusterUtil.MasterThread addMaster(Configuration c, final int index)
throws IOException {
  // Create each master with its own Configuration instance so each has
  // its HConnection instance rather than share (see HBASE_INSTANCES down in
  // the guts of HConnectionManager.
  JVMClusterUtil.MasterThread mt = JVMClusterUtil.createMasterThread(c,
      (Class<? extends HMaster>) conf.getClass(HConstants.MASTER_IMPL, this.masterClass), index);
  this.masterThreads.add(mt);
  return mt;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:LocalHBaseCluster.java

示例11: waitOnMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * Wait for the specified master to stop
 * Removes this thread from list of running threads.
 * @param serverNumber
 * @return Name of master that just went down.
 */
public String waitOnMaster(int serverNumber) {
  JVMClusterUtil.MasterThread masterThread =
    this.masterThreads.remove(serverNumber);
  while (masterThread.isAlive()) {
    try {
      LOG.info("Waiting on " +
        masterThread.getMaster().getServerName().toString());
      masterThread.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
  return masterThread.getName();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:LocalHBaseCluster.java

示例12: addMaster

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
public JVMClusterUtil.MasterThread addMaster(
    final Configuration c, final int index, User user)
throws IOException, InterruptedException {
  return user.runAs(
      new PrivilegedExceptionAction<JVMClusterUtil.MasterThread>() {
        public JVMClusterUtil.MasterThread run() throws Exception {
          return addMaster(c, index);
        }
      });
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:11,代码来源:LocalHBaseCluster.java

示例13: waitOnMasterThreads

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException {
    List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
    List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();

    if (masters != null) {
        for (JVMClusterUtil.MasterThread t : masters) {
            t.join();
            if (t.getMaster().isAborted()) {
                closeAllRegionServerThreads(regionservers);
                throw new RuntimeException("HMaster Aborted");
            }
        }
    }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:15,代码来源:HMasterCommandLine.java

示例14: getMasters

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * @return Read-only list of master threads.
 */
public List<JVMClusterUtil.MasterThread> getMasters() {
  return Collections.unmodifiableList(this.masterThreads);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:LocalHBaseCluster.java

示例15: getMasterThreads

import org.apache.hadoop.hbase.util.JVMClusterUtil; //导入方法依赖的package包/类
/**
 * @return List of master threads.
 */
public List<JVMClusterUtil.MasterThread> getMasterThreads() {
  return this.hbaseCluster.getMasters();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:MiniHBaseCluster.java


注:本文中的org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。