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


Java HdfsServerConstants.ReplicaState方法代码示例

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


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

示例1: ReplicaUnderConstruction

import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; //导入方法依赖的package包/类
ReplicaUnderConstruction(Block block,
    DatanodeStorageInfo target,
    HdfsServerConstants.ReplicaState state) {
  super(block);
  this.expectedLocation = target;
  this.state = state;
  this.chosenAsPrimary = false;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:ReplicaUnderConstruction.java

示例2: waitForTempReplica

import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; //导入方法依赖的package包/类
private void waitForTempReplica(Block bl, int DN_N1) throws IOException {
  final boolean tooLongWait = false;
  final int TIMEOUT = 40000;

  if(LOG.isDebugEnabled()) {
    LOG.debug("Wait for datanode " + DN_N1 + " to appear");
  }
  while (cluster.getDataNodes().size() <= DN_N1) {
    waitTil(20);
  }
  if(LOG.isDebugEnabled()) {
    LOG.debug("Total number of DNs " + cluster.getDataNodes().size());
  }
  cluster.waitActive();

  // Look about specified DN for the replica of the block from 1st DN
  final DataNode dn1 = cluster.getDataNodes().get(DN_N1);
  String bpid = cluster.getNamesystem().getBlockPoolId();
  Replica r = DataNodeTestUtils.fetchReplicaInfo(dn1, bpid, bl.getBlockId());
  long start = Time.monotonicNow();
  int count = 0;
  while (r == null) {
    waitTil(5);
    r = DataNodeTestUtils.fetchReplicaInfo(dn1, bpid, bl.getBlockId());
    long waiting_period = Time.monotonicNow() - start;
    if (count++ % 100 == 0)
      if(LOG.isDebugEnabled()) {
        LOG.debug("Has been waiting for " + waiting_period + " ms.");
      }
    if (waiting_period > TIMEOUT)
      assertTrue("Was waiting too long to get ReplicaInfo from a datanode",
        tooLongWait);
  }

  HdfsServerConstants.ReplicaState state = r.getState();
  if(LOG.isDebugEnabled()) {
    LOG.debug("Replica state before the loop " + state.getValue());
  }
  start = Time.monotonicNow();
  while (state != HdfsServerConstants.ReplicaState.TEMPORARY) {
    waitTil(5);
    state = r.getState();
    if(LOG.isDebugEnabled()) {
      LOG.debug("Keep waiting for " + bl.getBlockName() +
          " is in state " + state.getValue());
    }
    if (Time.monotonicNow() - start > TIMEOUT)
      assertTrue("Was waiting too long for a replica to become TEMPORARY",
        tooLongWait);
  }
  if(LOG.isDebugEnabled()) {
    LOG.debug("Replica state after the loop " + state.getValue());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:55,代码来源:BlockReportTestBase.java

示例3: getState

import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; //导入方法依赖的package包/类
/**
 * Get replica state as reported by the data-node.
 */
HdfsServerConstants.ReplicaState getState() {
  return state;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:7,代码来源:ReplicaUnderConstruction.java

示例4: setState

import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; //导入方法依赖的package包/类
/**
 * Set replica state.
 */
void setState(HdfsServerConstants.ReplicaState s) {
  state = s;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:7,代码来源:ReplicaUnderConstruction.java


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