- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中io.druid.java.util.common.guava.Yielder
类的一些代码示例,展示了Yielder
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yielder
类的具体详情如下:
包路径:io.druid.java.util.common.guava.Yielder
类名称:Yielder
[英]A Yielder is an object that tries to act like the yield() command/continuations in other languages. It's not necessarily good at this job, but it works. I think. Essentially, you can think of a Yielder as a linked list of items where the Yielder gives you access to the current head via get() and it will give you another Yielder representing the next item in the chain via next(). A Yielder that isDone() may return anything from both get() and next(), there is no contract and depending on those return values will likely lead to bugs. Once next is called, there is no guarantee and no requirement that references to old Yielder objects will continue to obey the contract. Yielders are Closeable and must be closed in order to prevent resource leaks. Once close() is called, the behavior of the whole chain of Yielders is undefined.
[中]Yielder是一个试图像其他语言中的yield()命令/continuations那样工作的对象。它不一定擅长这项工作,但它很管用。我想。本质上,你可以把一个Yielder看作是一个项目的链表,Yielder通过get()让你访问当前头部,它会给你另一个Yielder,通过next()代表链中的下一个项目。如果isDone()可能同时返回get()和next()中的任何内容,则没有约定,根据这些返回值可能会导致错误。一旦调用next,就不能保证也不要求对老Yielder对象的引用将继续遵守合同。YiElder是可关闭的,必须关闭,以防止资源泄漏。一旦调用close(),整个数据链的行为就没有定义。
代码示例来源:origin: io.druid/druid-server
@Override
public void close() throws IOException
{
rowYielder.close();
}
代码示例来源:origin: io.druid/java-util
@Override
public OutType get()
{
return baseYielder.get();
}
代码示例来源:origin: io.druid/druid-server
@Override
public boolean hasMore()
{
return !rowYielder.isDone();
}
代码示例来源:origin: io.druid/druid-processing
@Override
public void serialize(Yielder yielder, final JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException
{
try {
jgen.writeStartArray();
while (!yielder.isDone()) {
final Object o = yielder.get();
jgen.writeObject(o);
yielder = yielder.next(null);
}
jgen.writeEndArray();
}
finally {
yielder.close();
}
}
}
代码示例来源:origin: io.druid/java-util
OutType nextInit = yielder.get();
try {
yielder.close();
return makeYielder(yielderYielder.next(null), nextInit, accumulator);
代码示例来源:origin: io.druid/druid-server
@Nullable
@Override
public InputRow nextRow()
{
final InputRow inputRow = rowYielder.get();
rowYielder = rowYielder.next(null);
return transformer.transform(inputRow);
}
代码示例来源:origin: io.druid/java-util
if (!yielder.isDone()) {
queue.add(yielder);
} else {
try {
yielder.close();
代码示例来源:origin: io.druid/java-util
@Override
public Yielder<OutType> next(OutType initValue)
{
return wrapYielder(yielder.next(initValue), accumulator);
}
代码示例来源:origin: io.druid/java-util
public <OutType> Yielder<OutType> makeYielder(
Yielder<Sequence<T>> yielderYielder,
OutType initValue,
YieldingAccumulator<OutType, T> accumulator
)
{
while (!yielderYielder.isDone()) {
Yielder<OutType> yielder = yielderYielder.get().toYielder(initValue, accumulator);
if (accumulator.yielded()) {
return wrapYielder(yielder, yielderYielder, accumulator);
}
initValue = yielder.get();
try {
yielder.close();
}
catch (IOException e) {
throw Throwables.propagate(e);
}
yielderYielder = yielderYielder.next(null);
}
return Yielders.done(initValue, yielderYielder);
}
代码示例来源:origin: io.druid/druid-processing
@Override
public ScanResultValue next()
{
ScanResultValue batch = yielder.get();
if (ScanQuery.RESULT_FORMAT_COMPACTED_LIST.equals(resultFormat) ||
ScanQuery.RESULT_FORMAT_LIST.equals(resultFormat)) {
List events = (List) batch.getEvents();
if (events.size() <= limit - count) {
count += events.size();
yielder = yielder.next(null);
return batch;
} else {
// last batch
// single batch length is <= Integer.MAX_VALUE, so this should not overflow
int left = (int) (limit - count);
count = limit;
return new ScanResultValue(batch.getSegmentId(), batch.getColumns(), events.subList(0, left));
}
}
throw new UnsupportedOperationException(ScanQuery.RESULT_FORMAT_VALUE_VECTOR + " is not supported yet");
}
代码示例来源:origin: io.druid/java-util
@Override
public Yielder<OutType> next(OutType initValue)
{
return wrapYielder(yielder.next(initValue), yielderYielder, accumulator);
}
代码示例来源:origin: io.druid/java-util
while (!accumulator.yielded() && !pQueue.isEmpty()) {
Yielder<T> yielder = pQueue.remove();
retVal = accumulator.accumulate(retVal, yielder.get());
yielder = yielder.next(null);
if (yielder.isDone()) {
try {
yielder.close();
代码示例来源:origin: io.druid/druid-processing
@Override
public void close() throws IOException
{
yielder.close();
}
}
代码示例来源:origin: io.druid/java-util
@Override
public T apply(Yielder<T> input)
{
return input.get();
}
}
代码示例来源:origin: io.druid/druid-processing
@Override
public boolean hasNext()
{
return !yielder.isDone() && count < limit;
}
代码示例来源:origin: io.druid/java-util
@Override
public Yielder<OutType> get()
{
return new WrappingYielder<>(baseYielder.next(initValue), wrapper);
}
});
代码示例来源:origin: io.druid/java-util
@Override
public void close() throws IOException
{
try (Closeable toClose = yielderYielder) {
yielder.close();
}
}
};
代码示例来源:origin: io.druid/java-util
@Override
public OutType get()
{
return yielder.get();
}
代码示例来源:origin: io.druid/java-util
@Override
public boolean isDone()
{
return baseYielder.isDone();
}
代码示例来源:origin: io.druid/java-util
@Override
public Yielder<T> next(T initValue)
{
return new ExecuteWhenDoneYielder<>(baseYielder.next(initValue), runnable, executor);
}
这个问题不太可能帮助任何 future 的访客;它只与一个小地理区域、一个特定时刻或一个非常狭窄的情况相关,而这些情况通常不适用于互联网的全局受众。如需帮助使这个问题更广泛地适用,visit the
我有: data class Edge(val spec: String, val weight: Int) private val graph: SortedSetMultimap = TreeMu
鉴于使用以下代码创建的 Guava 缓存,如果未设置,是否有最大缓存大小? LoadingCache loadingCache = CacheBuilder.newBuilder().build(ne
我需要向 Guava Multimap 添加一个键,其中一个空集合作为值。我该如何做到这一点? 我试过这个: map.put( "my key", null ); 但是调用 get() 会返回一个包含
我刚刚遇到这样的代码: ExecutorService executorService = MoreExecutors.sameThreadExecutor(); for (int i = 0; i
我使用的是来自 Google Collections 的 com.google.common.collect.PrimitiveArrays,但是我在 Guava 中找不到它,是否已重命名?我在哪里可
当前,我正在使用以下代码在映射中创建过滤器以匹配并提供过滤后的结果集列表。 final Map filteredMap = Maps.filterKeys(mymap, Predicates.cont
当我在 app/build.gradle 中使用 implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
Google Guava Cache 文档指出: Refreshing is not quite the same as eviction. As specified in LoadingCache.
Guava 的 ImmutableList.Builder 的线程安全保证是什么? javadocs 没有说。 最佳答案 虽然 Guava Immutable 类是线程安全的,但它们的构建器不是。对于
目前我在我的应用程序中使用 guava EventBus 方法。监听器尝试做一些工作,如果失败,事件应该回到总线并重新发送。 我的问题是:如果我的应用程序出现故障(执行关闭)怎么办?它会在总线上发送剩
是否可以使用现有的 java 静态方法作为开箱即用的扩展? 让我们考虑 com.google.common.collect.Iterables.transform。现在,因为我不知道如何处理这个问题,
我想创建一个由 Guava 函数支持的只读 map 。我有一个提供值的函数,给定一个键。 Function f = new Function() { public Object apply(f
我最近将 Google Guava 作为库添加到我的 Eclipse 项目中(我从 http://code.google.com/p/guava-libraries/ 下载了“guava-16.0.j
我们最近从 Drools 5 升级到 Drools 6 并遇到了令人不安的冲突问题。 我们有kie-ci导入到项目中。 kie-ci引进 sisu-guava . sisu-guava改变了谷歌 Gu
尝试取消注册时,我在我的一个类(class)中收到以下错误。 java.lang.IllegalArgumentException: missing event handler for an anno
我的项目传递依赖于 Google Guava lib。突然(使用新版本的 Guava ?)应用程序在启动时崩溃java.lang.NoSuchMethodError: 'java.util.strea
我喜欢 Google Guava 并且经常使用它,但是我总是发现我在写一种方法。 public static T tryFind(Iterable iterable, Predicate pred
我使用的是普通的旧 Java 1.6,并且对这两个库都感兴趣。 阅读文档后,我不确定是否存在差异(如果有的话)。任何人都可以解释一下,或者指出一些相关信息吗?提前致谢! 最佳答案 RxJava 比 L
我用的是 Guava 17.0 private static final ConcurrentMap imageMap = new MapMaker().softValues().ma
我是一名优秀的程序员,十分优秀!