本文整理了Java中org.apache.druid.java.util.common.guava.YieldingAccumulator
类的一些代码示例,展示了YieldingAccumulator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldingAccumulator
类的具体详情如下:
包路径:org.apache.druid.java.util.common.guava.YieldingAccumulator
类名称:YieldingAccumulator
[英]A YieldingAccumulator is used along with a Yielder in order to replicate continuations in Java. I'm still not sure this is such a great idea, but it's there. We shall see. The accumulated has its accumulate() method called and has the option of "yielding" its response by calling yield() before returning as response. If it chooses not to yield its response, then it expects to get called again with the next value and the value it just returned.
[中]YieldingAccumulator与Yielder一起用于在Java中复制连续性。我仍然不确定这是否是一个好主意,但它确实存在。我们拭目以待。Cumulated函数调用了它的cumulated()方法,并且可以通过调用yield()来“产生”它的响应,然后作为响应返回。如果它选择不产生响应,那么它会再次被调用,并返回下一个值和刚刚返回的值。
代码示例来源:origin: apache/incubator-druid
while (!accumulator.yielded() && iter.hasNext()) {
retVal = accumulator.accumulate(retVal, iter.next());
if (!accumulator.yielded()) {
return Yielders.done(
retVal,
代码示例来源:origin: apache/incubator-druid
@Override
public void reset()
{
baseAccumulator.reset();
}
代码示例来源:origin: apache/incubator-druid
@Override
public void yield()
{
accumulator.yield();
}
代码示例来源:origin: apache/incubator-druid
@Override
public boolean yielded()
{
return accumulator.yielded();
}
代码示例来源:origin: apache/incubator-druid
@Override
public OutType accumulate(OutType accumulated, T in)
{
return delegate.accumulate(accumulated, in);
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public Yielder<T> accumulate(Yielder<T> accumulated, Sequence<T> in)
{
final Yielder<T> retVal = in.toYielder(
null,
new YieldingAccumulator<T, T>()
{
@Override
public T accumulate(T accumulated, T in)
{
yield();
return in;
}
}
);
if (retVal.isDone()) {
try {
retVal.close();
}
catch (IOException e) {
throw Throwables.propagate(e);
}
return null;
} else {
yield();
}
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public boolean yielded()
{
return baseAccumulator.yielded();
}
代码示例来源:origin: apache/incubator-druid
void accumulateLastValue()
{
retVal = accumulator.accumulate(retVal, lastMergedVal);
}
代码示例来源:origin: org.apache.druid/druid-common
@Override
public Yielder<T> accumulate(Yielder<T> accumulated, Sequence<T> in)
{
final Yielder<T> retVal = in.toYielder(
null,
new YieldingAccumulator<T, T>()
{
@Override
public T accumulate(T accumulated, T in)
{
yield();
return in;
}
}
);
if (retVal.isDone()) {
try {
retVal.close();
}
catch (IOException e) {
throw Throwables.propagate(e);
}
return null;
} else {
yield();
}
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
while (!accumulator.yielded() && !pQueue.isEmpty()) {
Yielder<T> yielder = pQueue.remove();
retVal = accumulator.accumulate(retVal, yielder.get());
yielder = yielder.next(null);
if (yielder.isDone()) {
if (pQueue.isEmpty() && !accumulator.yielded()) {
return Yielders.done(retVal, null);
代码示例来源:origin: apache/incubator-druid
@Override
public boolean yielded()
{
return accumulator.yielded();
}
代码示例来源:origin: apache/incubator-druid
@Override
public void reset()
{
didSomething = false;
accumulator.reset();
}
代码示例来源:origin: apache/incubator-druid
@Override
public OutType accumulate(OutType accumulated, InType in)
{
return baseAccumulator.accumulate(accumulated, fn.apply(in));
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void yield()
{
delegate.yield();
}
代码示例来源:origin: apache/incubator-druid
while (!accumulator.yielded() && (!pQueue.isEmpty() || !oldDudeAtCrosswalk.isDone())) {
Yielder<T> yielder;
if (oldDudeAtCrosswalk.isDone()) {
retVal = accumulator.accumulate(retVal, yielder.get());
yielder = yielder.next(null);
if (yielder.isDone()) {
if (!accumulator.yielded()) {
return Yielders.done(retVal, oldDudeAtCrosswalk);
代码示例来源:origin: apache/incubator-druid
@Override
public boolean yielded()
{
return delegate.yielded();
}
代码示例来源:origin: apache/incubator-druid
@Override
public Yielder<OutType> next(OutType initValue)
{
accumulator.reset();
return makeYielder(pQueue, finalOldDudeAtCrosswalk, initValue, accumulator);
}
代码示例来源:origin: apache/incubator-druid
@Override
public OutType accumulate(OutType accumulated, T in)
{
if (pred.apply(in)) {
if (!didSomething) {
didSomething = true;
}
return accumulator.accumulate(accumulated, in);
}
return accumulated;
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void yield()
{
accumulator.yield();
}
代码示例来源:origin: org.apache.druid/java-util
while (!accumulator.yielded() && iter.hasNext()) {
retVal = accumulator.accumulate(retVal, iter.next());
if (!accumulator.yielded()) {
return Yielders.done(
retVal,
内容来源于网络,如有侵权,请联系作者删除!