- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.accumulo.core.iterators.YieldCallback
类的一些代码示例,展示了YieldCallback
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldCallback
类的具体详情如下:
包路径:org.apache.accumulo.core.iterators.YieldCallback
类名称:YieldCallback
[英]This callback handles the state of yielding within an iterator
[中]这个回调处理迭代器中的屈服状态
代码示例来源:origin: apache/accumulo
boolean skipContinueKey = false;
YieldCallback<Key> yield = new YieldCallback<>();
if (yield.hasYielded()) {
throw new IOException(
"Coding error: hasTop returned true but has yielded at " + yield.getPositionAndReset());
if (yield.hasYielded()) {
continueKey = new Key(yield.getPositionAndReset());
skipContinueKey = true;
if (!range.contains(continueKey)) {
代码示例来源:origin: apache/accumulo
TreeMap<Key,Value> consume(IteratorTestInput testInput, SortedKeyValueIterator<Key,Value> skvi,
YieldCallback<Key> yield) throws IOException {
TreeMap<Key,Value> data = new TreeMap<>();
Key lastKey = null;
while (yield.hasYielded() || skvi.hasTop()) {
if (yield.hasYielded()) {
Range r = testInput.getRange();
Key yieldPosition = yield.getPositionAndReset();
if (!r.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
+ yieldPosition + " not in " + r);
}
if (skvi.hasTop()) {
throw new IOException(
"Underlying iterator reports having a top, but has yielded: " + yieldPosition);
}
if (lastKey != null && yieldPosition.compareTo(lastKey) <= 0) {
throw new IOException(
"Underlying iterator yielded at a position that is not past the last key returned");
}
skvi.seek(new Range(yieldPosition, false, r.getEndKey(), r.isEndKeyInclusive()),
testInput.getFamilies(), testInput.isInclusive());
} else {
// Make sure to copy the K-V
data.put(new Key(skvi.getTopKey()), new Value(skvi.getTopValue()));
skvi.next();
}
}
return data;
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public boolean hasTop() {
return (!(yield.isPresent() && yield.get().hasYielded()) && super.hasTop());
}
代码示例来源:origin: apache/accumulo
@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
final SortedKeyValueIterator<Key,Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
final SortedKeyValueIterator<Key,Value> source = IteratorTestUtil.createSource(testInput);
try {
skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
YieldCallback<Key> yield = new YieldCallback<>();
skvi.enableYielding(yield);
skvi.seek(testInput.getRange(), testInput.getFamilies(), testInput.isInclusive());
return new IteratorTestOutput(consume(testInput, skvi, yield));
} catch (IOException e) {
return new IteratorTestOutput(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public void next() throws IOException {
log.info("start YieldingIterator.next: " + getTopValue());
boolean yielded = false;
// yield on every other next call.
yieldNextKey.set(!yieldNextKey.get());
if (yield.isPresent() && yieldNextKey.get()) {
yielded = true;
yieldNexts.incrementAndGet();
// since we are not actually skipping keys underneath, simply use the key following the top
// key as the yield key
yield.get().yield(getTopKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME));
log.info("end YieldingIterator.next: yielded at " + getTopKey());
}
// if not yielding, then simply pass on the next call
if (!yielded) {
super.next();
log.info("end YieldingIterator.next: "
+ (hasTop() ? getTopKey() + " " + getTopValue() : "no top"));
}
}
代码示例来源:origin: apache/accumulo
boolean yielded = (yield.isPresent() && yield.get().hasYielded());
iter.seek(range, columnFamilies, inclusive);
else if (yielded) {
Key yieldPosition = yield.get().getPositionAndReset();
if (!range.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
if (yield.isPresent() && yield.get().hasYielded()) {
throw new IOException("Coding error: hasTop returned true but has yielded at "
+ yield.get().getPositionAndReset());
代码示例来源:origin: org.apache.accumulo/accumulo-iterator-test-harness
@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
final SortedKeyValueIterator<Key,Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
final SortedKeyValueIterator<Key,Value> source = IteratorTestUtil.createSource(testInput);
try {
skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
YieldCallback<Key> yield = new YieldCallback<>();
if (skvi instanceof YieldingKeyValueIterator) {
((YieldingKeyValueIterator<Key,Value>) skvi).enableYielding(yield);
}
skvi.seek(testInput.getRange(), testInput.getFamilies(), testInput.isInclusive());
return new IteratorTestOutput(consume(testInput, skvi, yield));
} catch (IOException e) {
return new IteratorTestOutput(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
log.info("start YieldingIterator.seek: " + getTopValue() + " with range " + range);
boolean yielded = false;
if (!range.isStartKeyInclusive()) {
rebuilds.incrementAndGet();
// yield on every other seek call.
yieldSeekKey.set(!yieldSeekKey.get());
if (yield.isPresent() && yieldSeekKey.get()) {
yielded = true;
yieldSeeks.incrementAndGet();
// since we are not actually skipping keys underneath, simply use the key following the
// range start key
yield.get()
.yield(range.getStartKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME));
log.info("end YieldingIterator.next: yielded at " + range.getStartKey());
}
}
// if not yielding, then simply pass on the call to the source
if (!yielded) {
super.seek(range, columnFamilies, inclusive);
log.info("end YieldingIterator.seek: "
+ (hasTop() ? getTopKey() + " " + getTopValue() : "no top"));
}
}
代码示例来源:origin: apache/accumulo
YieldCallback<Key> yield = new YieldCallback<>();
mmfi.enableYielding(yield);
boolean yielded = false;
if (yield.hasYielded()) {
throw new IOException("Coding error: hasTop returned true but has yielded at "
+ yield.getPositionAndReset());
if (yield.hasYielded()) {
yielded = true;
Key yieldPosition = yield.getPositionAndReset();
if (!range.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
代码示例来源:origin: org.apache.accumulo/accumulo-iterator-test-harness
TreeMap<Key,Value> consume(IteratorTestInput testInput, SortedKeyValueIterator<Key,Value> skvi,
YieldCallback<Key> yield) throws IOException {
TreeMap<Key,Value> data = new TreeMap<>();
Key lastKey = null;
while (yield.hasYielded() || skvi.hasTop()) {
if (yield.hasYielded()) {
Range r = testInput.getRange();
Key yieldPosition = yield.getPositionAndReset();
if (!r.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
+ yieldPosition + " not in " + r);
}
if (skvi.hasTop()) {
throw new IOException(
"Underlying iterator reports having a top, but has yielded: " + yieldPosition);
}
if (lastKey != null && yieldPosition.compareTo(lastKey) <= 0) {
throw new IOException(
"Underlying iterator yielded at a position that is not past the last key returned");
}
skvi.seek(new Range(yieldPosition, false, r.getEndKey(), r.isEndKeyInclusive()),
testInput.getFamilies(), testInput.isInclusive());
} else {
// Make sure to copy the K-V
data.put(new Key(skvi.getTopKey()), new Value(skvi.getTopValue()));
skvi.next();
}
}
return data;
}
代码示例来源:origin: org.apache.accumulo/accumulo-tserver
boolean skipContinueKey = false;
YieldCallback<Key> yield = new YieldCallback<>();
if (yield.hasYielded()) {
throw new IOException(
"Coding error: hasTop returned true but has yielded at " + yield.getPositionAndReset());
if (yield.hasYielded()) {
continueKey = new Key(yield.getPositionAndReset());
skipContinueKey = true;
if (!range.contains(continueKey)) {
代码示例来源:origin: org.apache.accumulo/accumulo-core
boolean yielded = (yield.isPresent() && yield.get().hasYielded());
iter.seek(range, columnFamilies, inclusive);
else if (yielded) {
Key yieldPosition = yield.get().getPositionAndReset();
if (!range.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
if (yield.isPresent() && yield.get().hasYielded()) {
throw new IOException("Coding error: hasTop returned true but has yielded at "
+ yield.get().getPositionAndReset());
代码示例来源:origin: org.apache.accumulo/accumulo-tserver
YieldCallback<Key> yield = new YieldCallback<>();
if (mmfi instanceof YieldingKeyValueIterator)
((YieldingKeyValueIterator<Key,Value>) mmfi).enableYielding(yield);
if (yield.hasYielded()) {
throw new IOException("Coding error: hasTop returned true but has yielded at "
+ yield.getPositionAndReset());
if (yield.hasYielded()) {
yielded = true;
Key yieldPosition = yield.getPositionAndReset();
if (!range.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
我正在尝试表达以下内容: 给定一个矩阵和两个索引增量,返回矩阵中所有数字的四倍体:沿行,列或对角线的四倍体。 use std::iter::Iterator; use std::iter::Peeka
假设我们有以下类组成角色 Iterable : class Word-Char does Iterable { has @.words; method !pairize($item)
我编写了一个 ADT 排序二叉树,其功能如下: public Iterator getInorderIterator(){ return new InorderIterator(); } 有效
在包装(内部)迭代器时,通常必须将 __iter__ 方法重新路由到底层可迭代对象。考虑以下示例: class FancyNewClass(collections.Iterable): def
尽管如此,我遍历了以下 NSSet , NSMutableArray , NSFastEnumeration文档,我找不到下面提到的场景的令人满意的来源: 此处,NSMutableArray、NSAr
我发现在 Python 中 collections.Iterable 和 typing.Iterable 都可以用于类型注释和检查对象是否可迭代,即 >isinstance(obj, collecti
我想拆分实现 Iterator 的对象的输出分为两个实现 Iterator 的对象和 Iterator .由于其中一个输出的迭代次数可能比另一个多,因此我需要缓冲 Iterator 的输出。 (因为我
我正在尝试用 Rust 编写一个简单的迭代器: #[derive(Debug)] pub struct StackVec { storage: &'a mut [T], len: us
什么意思: Separator.Iterator.Element == Self.Iterator.Element.Iterator.Element 在this (Swift 标准库)swift 实例
调用 anIterable.iterator() 会返回新的迭代器还是现有的迭代器?它依赖于 Iterable 的实现吗? 更具体地说,以下代码是否按预期工作(即内部循环将从头开始迭代)? for (
我正在尝试转换 &str 的矢量对成一个 HashMap使用以下代码片段: use std::collections::HashMap; fn main() { let pairs = vec!(
这将使安全地迭代同一元素两次成为可能,或者为在项目类型中迭代的全局事物保持某种状态。 类似于: trait IterShort where Self: Borrow, { type I
我在 String 的字符上使用迭代器: pub fn is_yelling(message: &str) -> bool { let letters = message.chars().fi
这将使安全地迭代同一元素两次成为可能,或者为在项目类型中迭代的全局事物保持某种状态。 类似于: trait IterShort where Self: Borrow, { type I
要在 Rust 中实现迭代器,我们只需要实现 next 方法,如 in the documentation 所解释的那样.但是,Iterator 特征 has many more methods .
我正在为多个结构实现 Iterator 特性并遇到了一些问题。为什么为 Rows 实现 Iterator 显示错误?这是一个链接:link to playground 基本上为什么这不起作用? str
我将集合转储到磁盘上。当请求时,应该检索这些集合(没问题)和 iterator应该为它构建返回对检索到的值的引用。 iterator之后被丢弃了,我不再需要收藏了。我也希望它被删除。 到目前为止我尝试
我正在尝试为实现特征的结构实现默认迭代器。我的特征称为 DataRow,代表一行表格单元格,如下所示: pub trait DataRow { // Gets a cell by index
Rust 中是否有提供 iter() 的 Trait方法?我只找到了特征 IntoIterator ,供应into_iter() . 这里要明确一点:我不想要 Iterator特性,提供 next()
我想在迭代器上定义一个 .unique() 方法,使我能够在没有重复的情况下进行迭代。 use std::collections::HashSet; struct UniqueState {
我是一名优秀的程序员,十分优秀!