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


Java EnvironmentEdge类代码示例

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


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

示例1: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final WAL wal,
    final HTableDescriptor htd, final MultiVersionConcurrencyControl mvcc) throws IOException {
  String familyStr = Bytes.toString(family);
  long txid = -1;
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes, ee.currentTime(), columnBytes));
    // uses WALKey instead of HLogKey on purpose. will only work for tests where we don't care
    // about legacy coprocessors
    txid = wal.append(htd, hri, new WALKey(hri.getEncodedNameAsBytes(), tableName,
        ee.currentTime(), mvcc), edit, true);
  }
  if (-1 != txid) {
    wal.sync(txid);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestWALObserver.java

示例2: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final WAL wal,
    final HTableDescriptor htd, final MultiVersionConcurrencyControl mvcc)
throws IOException {
  String familyStr = Bytes.toString(family);
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes,
      ee.currentTime(), columnBytes));
    wal.append(htd, hri, new WALKey(hri.getEncodedNameAsBytes(), tableName,999, mvcc),
        edit, true);
  }
  wal.sync();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestWALReplay.java

示例3: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final WAL wal,
    final HTableDescriptor htd, final AtomicLong sequenceId) throws IOException {
  String familyStr = Bytes.toString(family);
  long txid = -1;
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes, ee.currentTime(), columnBytes));
    // uses WALKey instead of HLogKey on purpose. will only work for tests where we don't care
    // about legacy coprocessors
    txid = wal.append(htd, hri, new WALKey(hri.getEncodedNameAsBytes(), tableName,
        ee.currentTime()), edit, sequenceId, true, null);
  }
  if (-1 != txid) {
    wal.sync(txid);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:20,代码来源:TestWALObserver.java

示例4: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final WAL wal,
    final HTableDescriptor htd, final AtomicLong sequenceId)
throws IOException {
  String familyStr = Bytes.toString(family);
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes,
      ee.currentTime(), columnBytes));
    wal.append(htd, hri, new WALKey(hri.getEncodedNameAsBytes(), tableName, ee.currentTime()),
        edit, sequenceId, true, null);
  }
  wal.sync();
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:17,代码来源:TestWALReplay.java

示例5: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final RegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final WAL wal,
    final NavigableMap<byte[], Integer> scopes, final MultiVersionConcurrencyControl mvcc)
    throws IOException {
  String familyStr = Bytes.toString(family);
  long txid = -1;
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes, ee.currentTime(), columnBytes));
    // uses WALKeyImpl instead of HLogKey on purpose. will only work for tests where we don't care
    // about legacy coprocessors
    txid = wal.append(hri,
      new WALKeyImpl(hri.getEncodedNameAsBytes(), tableName, ee.currentTime(), mvcc), edit, true);
  }
  if (-1 != txid) {
    wal.sync(txid);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestWALObserver.java

示例6: waitForRegion

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void waitForRegion() throws InterruptedIOException {
  if (busyRegions.isEmpty()) {
    return;
  }
  EnvironmentEdge ee = EnvironmentEdgeManager.getDelegate();
  final long start = ee.currentTime();
  while ((ee.currentTime() - start) <= MAX_WAITING_TIME) {
    for (byte[] region : busyRegions) {
      AtomicInteger count = taskCounterPerRegion.get(region);
      if (count == null || count.get() < maxConcurrentTasksPerRegion) {
        return;
      }
    }
    try {
      synchronized (tasksInProgress) {
        tasksInProgress.wait(10);
      }
    } catch (InterruptedException e) {
      throw new InterruptedIOException("Interrupted."
              + " tasksInProgress=" + tasksInProgress);
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:SimpleRequestController.java

示例7: addRegionEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
static List<Put> addRegionEdits (final byte [] rowName, final byte [] family,
    final int count, EnvironmentEdge ee, final Region r,
    final String qualifierPrefix)
throws IOException {
  List<Put> puts = new ArrayList<Put>();
  for (int j = 0; j < count; j++) {
    byte[] qualifier = Bytes.toBytes(qualifierPrefix + Integer.toString(j));
    Put p = new Put(rowName);
    p.add(family, qualifier, ee.currentTime(), rowName);
    r.put(p);
    puts.add(p);
  }
  return puts;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:TestWALReplay.java

示例8: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits (final byte [] tableName, final HRegionInfo hri,
    final byte [] rowName, final byte [] family,
    final int count, EnvironmentEdge ee, final HLog wal, final HTableDescriptor htd)
throws IOException {
  String familyStr = Bytes.toString(family);
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes,
      ee.currentTimeMillis(), columnBytes));
    wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:TestWALObserver.java

示例9: addRegionEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addRegionEdits (final byte [] rowName, final byte [] family,
    final int count, EnvironmentEdge ee, final HRegion r,
    final String qualifierPrefix)
throws IOException {
  for (int j = 0; j < count; j++) {
    byte[] qualifier = Bytes.toBytes(qualifierPrefix + Integer.toString(j));
    Put p = new Put(rowName);
    p.add(family, qualifier, ee.currentTimeMillis(), rowName);
    r.put(p);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:TestWALReplay.java

示例10: addRegionEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
static List<Put> addRegionEdits (final byte [] rowName, final byte [] family,
    final int count, EnvironmentEdge ee, final HRegion r,
    final String qualifierPrefix)
throws IOException {
  List<Put> puts = new ArrayList<Put>();
  for (int j = 0; j < count; j++) {
    byte[] qualifier = Bytes.toBytes(qualifierPrefix + Integer.toString(j));
    Put p = new Put(rowName);
    p.add(family, qualifier, ee.currentTime(), rowName);
    r.put(p);
    puts.add(p);
  }
  return puts;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:15,代码来源:TestWALReplay.java

示例11: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri,
    final byte[] rowName, final byte[] family, final int count,
    EnvironmentEdge ee, final HLog wal, final HTableDescriptor htd, final AtomicLong sequenceId)
    throws IOException {
  String familyStr = Bytes.toString(family);
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes, ee
        .currentTimeMillis(), columnBytes));
    wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd, sequenceId);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:15,代码来源:TestWALObserver.java

示例12: addWALEdits

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private void addWALEdits(final TableName tableName, final HRegionInfo hri, final byte[] rowName,
    final byte[] family, final int count, EnvironmentEdge ee, final HLog wal,
    final HTableDescriptor htd, final AtomicLong sequenceId)
throws IOException {
  String familyStr = Bytes.toString(family);
  for (int j = 0; j < count; j++) {
    byte[] qualifierBytes = Bytes.toBytes(Integer.toString(j));
    byte[] columnBytes = Bytes.toBytes(familyStr + ":" + Integer.toString(j));
    WALEdit edit = new WALEdit();
    edit.add(new KeyValue(rowName, family, qualifierBytes,
      ee.currentTimeMillis(), columnBytes));
    wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd, sequenceId);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:15,代码来源:TestWALReplay.java

示例13: testOverconsumptionFixedIntervalRefillStrategy

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
@Test
public void testOverconsumptionFixedIntervalRefillStrategy() throws InterruptedException {
  RateLimiter limiter = new FixedIntervalRateLimiter();
  limiter.set(10, TimeUnit.SECONDS);

  // fix the current time in order to get the precise value of interval
  EnvironmentEdge edge = new EnvironmentEdge() {
    private final long ts = System.currentTimeMillis();

    @Override
    public long currentTime() {
      return ts;
    }
  };
  EnvironmentEdgeManager.injectEdge(edge);
  // 10 resources are available, but we need to consume 20 resources
  // Verify that we have to wait at least 1.1sec to have 1 resource available
  assertTrue(limiter.canExecute());
  limiter.consume(20);
  // To consume 1 resource also wait for 1000ms
  assertEquals(1000, limiter.waitInterval(1));
  // To consume 10 resource wait for 100ms
  assertEquals(1000, limiter.waitInterval(10));
  EnvironmentEdgeManager.reset();

  limiter.setNextRefillTime(limiter.getNextRefillTime() - 900);
  // Verify that after 1sec also no resource should be available
  assertFalse(limiter.canExecute(1));
  limiter.setNextRefillTime(limiter.getNextRefillTime() - 100);

  // Verify that after 1sec the 10 resource is available
  assertTrue(limiter.canExecute());
  assertEquals(0, limiter.waitInterval());
}
 
开发者ID:apache,项目名称:hbase,代码行数:35,代码来源:TestRateLimiter.java

示例14: setEnvironmentEdge

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
@BeforeClass
public static void setEnvironmentEdge() throws Exception {
  EnvironmentEdge ee = new TimeOffsetEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(ee);
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.setInt(HStore.BLOCKING_STOREFILES_KEY, 10000);
  TEST_UTIL.startMiniCluster(1);
}
 
开发者ID:apache,项目名称:hbase,代码行数:9,代码来源:TestFIFOCompactionPolicy.java

示例15: createWALEdit

import org.apache.hadoop.hbase.util.EnvironmentEdge; //导入依赖的package包/类
private WALEdit createWALEdit(final byte[] rowName, final byte[] family, EnvironmentEdge ee,
    int index) {
  byte[] qualifierBytes = Bytes.toBytes(Integer.toString(index));
  byte[] columnBytes = Bytes.toBytes(Bytes.toString(family) + ":" + Integer.toString(index));
  WALEdit edit = new WALEdit();
  edit.add(new KeyValue(rowName, family, qualifierBytes, ee.currentTime(), columnBytes));
  return edit;
}
 
开发者ID:apache,项目名称:hbase,代码行数:9,代码来源:AbstractTestWALReplay.java


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