本文整理汇总了Java中com.clearspring.analytics.stream.cardinality.CardinalityMergeException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java CardinalityMergeException.printStackTrace方法的具体用法?Java CardinalityMergeException.printStackTrace怎么用?Java CardinalityMergeException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.clearspring.analytics.stream.cardinality.CardinalityMergeException
的用法示例。
在下文中一共展示了CardinalityMergeException.printStackTrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: combine
import com.clearspring.analytics.stream.cardinality.CardinalityMergeException; //导入方法依赖的package包/类
@Override
public HyperLogLog combine(HyperLogLog one, HyperLogLog other) {
try {
// logger.trace("Combine called merging now " + one.cardinality() + " cardinality of other " + other.cardinality());
return (HyperLogLog) one.merge(other);
} catch (CardinalityMergeException e) {
logger.fatal("Cardinality merge exception " + e.getMessage());
e.printStackTrace();
}
return zero();
}
示例2: testMerge
import com.clearspring.analytics.stream.cardinality.CardinalityMergeException; //导入方法依赖的package包/类
@Test
public void testMerge() {
HyperLogLog hll = new HyperLogLog(16);
for (int i = 0; i < 10; i++) {
hll.offer(i);
}
HyperLogLog hll2 = new HyperLogLog(16);
for (int i = 1000; i < (1000 + 10); i++) {
hll2.offer(i);
}
HyperLogLog hll3 = new HyperLogLog(16);
assertEquals(hll.cardinality(), 10);
assertEquals(hll2.cardinality(), 10);
assertEquals(hll3.cardinality(), 0);
try {
ICardinality hllMerged = hll.merge(hll2);
hllMerged = hllMerged.merge(hll3);
// System.out.println(hllMerged.cardinality());
assertEquals(hllMerged.cardinality(), 20);
} catch (CardinalityMergeException e) {
e.printStackTrace();
}
}