本文整理汇总了Java中org.apache.hadoop.hbase.CompatibilitySingletonFactory类的典型用法代码示例。如果您正苦于以下问题:Java CompatibilitySingletonFactory类的具体用法?Java CompatibilitySingletonFactory怎么用?Java CompatibilitySingletonFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompatibilitySingletonFactory类属于org.apache.hadoop.hbase包,在下文中一共展示了CompatibilitySingletonFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: MetricsRegionServerWrapperImpl
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
public MetricsRegionServerWrapperImpl(final HRegionServer regionServer) {
this.regionServer = regionServer;
initBlockCache();
this.period =
regionServer.conf.getLong(HConstants.REGIONSERVER_METRICS_PERIOD,
HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD);
this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
this.runnable = new RegionServerMetricsWrapperRunnable();
this.executor.scheduleWithFixedDelay(this.runnable, this.period, this.period,
TimeUnit.MILLISECONDS);
if (LOG.isInfoEnabled()) {
LOG.info("Computing regionserver metrics every " + this.period + " milliseconds");
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:MetricsRegionServerWrapperImpl.java
示例2: testCompareToHashCodeEquals
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testCompareToHashCodeEquals() throws Exception {
MetricsRegionServerSourceFactory fact = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource oneClone = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource two = fact.createRegion(new RegionWrapperStub("TWO"));
assertEquals(0, one.compareTo(oneClone));
assertEquals(one.hashCode(), oneClone.hashCode());
assertNotEquals(one, two);
assertTrue( one.compareTo(two) != 0);
assertTrue( two.compareTo(one) != 0);
assertTrue( two.compareTo(one) != one.compareTo(two));
assertTrue( two.compareTo(two) == 0);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestMetricsRegionSourceImpl.java
示例3: MetricsRegionServerWrapperImpl
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
public MetricsRegionServerWrapperImpl(final HRegionServer regionServer) {
this.regionServer = regionServer;
initBlockCache();
initMobFileCache();
this.period =
regionServer.conf.getLong(HConstants.REGIONSERVER_METRICS_PERIOD,
HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD);
this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
this.runnable = new RegionServerMetricsWrapperRunnable();
this.executor.scheduleWithFixedDelay(this.runnable, this.period, this.period,
TimeUnit.MILLISECONDS);
this.metricsWALSource = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
try {
this.dfsHedgedReadMetrics = FSUtils.getDFSHedgedReadMetrics(regionServer.getConfiguration());
} catch (IOException e) {
LOG.warn("Failed to get hedged metrics", e);
}
if (LOG.isInfoEnabled()) {
LOG.info("Computing regionserver metrics every " + this.period + " milliseconds");
}
}
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:MetricsRegionServerWrapperImpl.java
示例4: testBatchPutWithTsSlop
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testBatchPutWithTsSlop() throws Exception {
// add data with a timestamp that is too recent for range. Ensure assert
CONF.setInt("hbase.hregion.keyvalue.timestamp.slop.millisecs", 1000);
final Put[] puts = new Put[10];
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
try {
long syncs = prepareRegionForBachPut(puts, source, true);
OperationStatus[] codes = this.region.batchMutate(puts);
assertEquals(10, codes.length);
for (int i = 0; i < 10; i++) {
assertEquals(OperationStatusCode.SANITY_CHECK_FAILURE, codes[i].getOperationStatusCode());
}
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs, source);
} finally {
HBaseTestingUtility.closeRegionAndWAL(this.region);
this.region = null;
}
}
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestHRegion.java
示例5: testCompareToHashCodeEquals
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@SuppressWarnings("SelfComparison")
@Test
public void testCompareToHashCodeEquals() throws Exception {
MetricsRegionServerSourceFactory fact = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource oneClone = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource two = fact.createRegion(new RegionWrapperStub("TWO"));
assertEquals(0, one.compareTo(oneClone));
assertEquals(one.hashCode(), oneClone.hashCode());
assertNotEquals(one, two);
assertTrue( one.compareTo(two) != 0);
assertTrue( two.compareTo(one) != 0);
assertTrue( two.compareTo(one) != one.compareTo(two));
assertTrue( two.compareTo(two) == 0);
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestMetricsRegionSourceImpl.java
示例6: testCompareToHashCode
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@SuppressWarnings("SelfComparison")
@Test
public void testCompareToHashCode() throws Exception {
MetricsRegionServerSourceFactory metricsFact =
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsTableSource one = metricsFact.createTable("ONETABLE", new TableWrapperStub("ONETABLE"));
MetricsTableSource oneClone = metricsFact.createTable("ONETABLE", new TableWrapperStub("ONETABLE"));
MetricsTableSource two = metricsFact.createTable("TWOTABLE", new TableWrapperStub("TWOTABLE"));
assertEquals(0, one.compareTo(oneClone));
assertEquals(one.hashCode(), oneClone.hashCode());
assertNotEquals(one, two);
assertTrue(one.compareTo(two) != 0);
assertTrue(two.compareTo(one) != 0);
assertTrue(two.compareTo(one) != one.compareTo(two));
assertTrue(two.compareTo(two) == 0);
}
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestMetricsTableSourceImpl.java
示例7: ThriftMetrics
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
public ThriftMetrics(Configuration conf, ThriftServerType t) {
slowResponseTime = conf.getLong( SLOW_RESPONSE_NANO_SEC, DEFAULT_SLOW_RESPONSE_NANO_SEC);
if (t == ThriftServerType.ONE) {
source = CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class).createThriftOneSource();
} else if (t == ThriftServerType.TWO) {
source = CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class).createThriftTwoSource();
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:ThriftMetrics.java
示例8: MetricsSource
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
/**
* Constructor used to register the metrics
*
* @param id Name of the source this class is monitoring
*/
public MetricsSource(String id) {
this.id = id;
singleSourceSource =
CompatibilitySingletonFactory.getInstance(MetricsReplicationSourceFactory.class)
.getSource(id);
globalSourceSource = CompatibilitySingletonFactory.getInstance(MetricsReplicationSourceFactory.class).getGlobalSource();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:MetricsSource.java
示例9: MetricsRegionWrapperImpl
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
public MetricsRegionWrapperImpl(HRegion region) {
this.region = region;
this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
this.runnable = new HRegionMetricsWrapperRunnable();
this.regionMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, PERIOD,
PERIOD, TimeUnit.SECONDS);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:MetricsRegionWrapperImpl.java
示例10: createTestTaskAttemptContext
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
private TaskAttemptContext createTestTaskAttemptContext(final Job job)
throws Exception {
HadoopShims hadoop = CompatibilitySingletonFactory.getInstance(HadoopShims.class);
TaskAttemptContext context = hadoop.createTestTaskAttemptContext(
job, "attempt_201402131733_0001_m_000000_0");
return context;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestHFileOutputFormat2.java
示例11: testBatchPut_whileNoRowLocksHeld
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testBatchPut_whileNoRowLocksHeld() throws IOException {
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
byte[] qual = Bytes.toBytes("qual");
byte[] val = Bytes.toBytes("val");
this.region = initHRegion(Bytes.toBytes(getName()), getName(), CONF, cf);
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
try {
long syncs = metricsAssertHelper.getCounter("syncTimeNumOps", source);
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs, source);
LOG.info("First a batch put with all valid puts");
final Put[] puts = new Put[10];
for (int i = 0; i < 10; i++) {
puts[i] = new Put(Bytes.toBytes("row_" + i));
puts[i].add(cf, qual, val);
}
OperationStatus[] codes = this.region.batchMutate(puts);
assertEquals(10, codes.length);
for (int i = 0; i < 10; i++) {
assertEquals(OperationStatusCode.SUCCESS, codes[i].getOperationStatusCode());
}
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 1, source);
LOG.info("Next a batch put with one invalid family");
puts[5].add(Bytes.toBytes("BAD_CF"), qual, val);
codes = this.region.batchMutate(puts);
assertEquals(10, codes.length);
for (int i = 0; i < 10; i++) {
assertEquals((i == 5) ? OperationStatusCode.BAD_FAMILY : OperationStatusCode.SUCCESS,
codes[i].getOperationStatusCode());
}
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 2, source);
} finally {
HRegion.closeHRegion(this.region);
this.region = null;
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:TestHRegion.java
示例12: testBatchPutWithTsSlop
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testBatchPutWithTsSlop() throws Exception {
byte[] b = Bytes.toBytes(getName());
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
byte[] qual = Bytes.toBytes("qual");
byte[] val = Bytes.toBytes("val");
// add data with a timestamp that is too recent for range. Ensure assert
CONF.setInt("hbase.hregion.keyvalue.timestamp.slop.millisecs", 1000);
this.region = initHRegion(b, getName(), CONF, cf);
try {
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
long syncs = metricsAssertHelper.getCounter("syncTimeNumOps", source);
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs, source);
final Put[] puts = new Put[10];
for (int i = 0; i < 10; i++) {
puts[i] = new Put(Bytes.toBytes("row_" + i), Long.MAX_VALUE - 100);
puts[i].add(cf, qual, val);
}
OperationStatus[] codes = this.region.batchMutate(puts);
assertEquals(10, codes.length);
for (int i = 0; i < 10; i++) {
assertEquals(OperationStatusCode.SANITY_CHECK_FAILURE, codes[i].getOperationStatusCode());
}
metricsAssertHelper.assertCounter("syncTimeNumOps", syncs, source);
} finally {
HRegion.closeHRegion(this.region);
this.region = null;
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:TestHRegion.java
示例13: testGetInstance
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testGetInstance() throws Exception {
MetricsMasterSourceFactory metricsMasterSourceFactory = CompatibilitySingletonFactory
.getInstance(MetricsMasterSourceFactory.class);
MetricsMasterSource masterSource = metricsMasterSourceFactory.create(null);
assertTrue(masterSource instanceof MetricsMasterSourceImpl);
assertSame(metricsMasterSourceFactory, CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class));
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:TestMetricsMasterSourceImpl.java
示例14: testGetInstance
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testGetInstance() throws Exception {
MetricsWALSource walSource =
CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
assertTrue(walSource instanceof MetricsWALSourceImpl);
assertSame(walSource,
CompatibilitySingletonFactory.getInstance(MetricsWALSource.class));
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:TestMetricsWALSourceImpl.java
示例15: testGetInstance
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testGetInstance() throws Exception {
MetricsRegionServerSourceFactory metricsRegionServerSourceFactory =
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsRegionServerSource serverSource =
metricsRegionServerSourceFactory.createServer(null);
assertTrue(serverSource instanceof MetricsRegionServerSourceImpl);
assertSame(metricsRegionServerSourceFactory,
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class));
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:TestMetricsRegionServerSourceImpl.java
示例16: MetricsRegionWrapperImpl
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
public MetricsRegionWrapperImpl(HRegion region) {
this.region = region;
this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
this.runnable = new HRegionMetricsWrapperRunnable();
this.regionMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, PERIOD,
PERIOD, TimeUnit.SECONDS);
this.coprocessorTimes = new HashMap<String, DescriptiveStatistics>();
}
开发者ID:grokcoder,项目名称:pbase,代码行数:9,代码来源:MetricsRegionWrapperImpl.java
示例17: createTestTaskAttemptContext
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
private TaskAttemptContext createTestTaskAttemptContext(final Job job)
throws IOException, Exception {
HadoopShims hadoop = CompatibilitySingletonFactory.getInstance(HadoopShims.class);
TaskAttemptContext context = hadoop.createTestTaskAttemptContext(
job, "attempt_201402131733_0001_m_000000_0");
return context;
}
开发者ID:grokcoder,项目名称:pbase,代码行数:8,代码来源:TestHFileOutputFormat2.java
示例18: testCompareToHashCodeEquals
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testCompareToHashCodeEquals() throws Exception {
MetricsRegionServerSourceFactory fact = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource oneClone = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource two = fact.createRegion(new RegionWrapperStub("TWO"));
assertEquals(0, one.compareTo(oneClone));
assertEquals(one.hashCode(), oneClone.hashCode());
assertNotEquals(one, two);
assertTrue( one.compareTo(two) < 0);
assertTrue( two.compareTo(one) > 0);
}
开发者ID:grokcoder,项目名称:pbase,代码行数:16,代码来源:TestMetricsRegionSourceImpl.java
示例19: MetricsSource
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
/**
* Constructor used to register the metrics
*
* @param id Name of the source this class is monitoring
*/
public MetricsSource(String id) {
this.id = id;
sizeOfLogQueKey = "source." + id + ".sizeOfLogQueue";
ageOfLastShippedOpKey = "source." + id + ".ageOfLastShippedOp";
logEditsReadKey = "source." + id + ".logEditsRead";
logEditsFilteredKey = "source." + id + ".logEditsFiltered";
shippedBatchesKey = "source." + this.id + ".shippedBatches";
shippedOpsKey = "source." + this.id + ".shippedOps";
shippedKBsKey = "source." + this.id + ".shippedKBs";
logReadInBytesKey = "source." + this.id + ".logReadInBytes";
rms = CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class);
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:MetricsSource.java
示例20: testCompareTo
import org.apache.hadoop.hbase.CompatibilitySingletonFactory; //导入依赖的package包/类
@Test
public void testCompareTo() throws Exception {
MetricsRegionServerSourceFactory fact = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource oneClone = fact.createRegion(new RegionWrapperStub("TEST"));
MetricsRegionSource two = fact.createRegion(new RegionWrapperStub("TWO"));
assertEquals(0, one.compareTo(oneClone));
assertTrue( one.compareTo(two) < 0);
assertTrue( two.compareTo(one) > 0);
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:14,代码来源:TestMetricsRegionSourceImpl.java
注:本文中的org.apache.hadoop.hbase.CompatibilitySingletonFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论