本文整理汇总了Java中org.apache.kafka.streams.state.KeyValueIterator.close方法的典型用法代码示例。如果您正苦于以下问题:Java KeyValueIterator.close方法的具体用法?Java KeyValueIterator.close怎么用?Java KeyValueIterator.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kafka.streams.state.KeyValueIterator
的用法示例。
在下文中一共展示了KeyValueIterator.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetch
import org.apache.kafka.streams.state.KeyValueIterator; //导入方法依赖的package包/类
private KeyValueIterator<Windowed<K>, V> fetch(Fetcher<K, V> fetcher) {
final List<ReadOnlySessionStore<K, V>> stores = storeProvider.stores(storeName, queryableStoreType);
for (final ReadOnlySessionStore<K, V> store : stores) {
try {
final KeyValueIterator<Windowed<K>, V> result = fetcher.fetch(store);
if (!result.hasNext()) {
result.close();
} else {
return result;
}
} catch (final InvalidStateStoreException ise) {
throw new InvalidStateStoreException("State store [" + storeName + "] is not available anymore" +
" and may have been migrated to another instance; " +
"please re-discover its location from the state metadata.");
}
}
return KeyValueIterators.emptyIterator();
}
示例2: punctuate
import org.apache.kafka.streams.state.KeyValueIterator; //导入方法依赖的package包/类
@Override
public void punctuate(long timestamp) {
KeyValueIterator<Long, List<OrderGoods>> iter = this.kvStore.all();
while (iter.hasNext()) {
KeyValue<Long, List<OrderGoods>> entry = (KeyValue<Long, List<OrderGoods>>) iter.next();
context.forward(entry.key, entry.value.toString());
}
iter.close();
context.commit();
}
示例3: closeOpenIterators
import org.apache.kafka.streams.state.KeyValueIterator; //导入方法依赖的package包/类
private void closeOpenIterators() {
HashSet<KeyValueIterator> iterators = null;
synchronized (openIterators) {
iterators = new HashSet<>(openIterators);
}
for (KeyValueIterator iterator : iterators) {
iterator.close();
}
}