public abstract class SequenceWrapper extends Object
| Constructor and Description |
|---|
SequenceWrapper() |
| Modifier and Type | Method and Description |
|---|---|
void |
after(boolean isDone,
Throwable thrown)
Executed after sequence processing, i.
|
void |
before()
Executed before sequence processing, i.
|
<RetType> RetType |
wrap(com.google.common.base.Supplier<RetType> sequenceProcessing)
Wraps any bits of the wrapped sequence processing:
Sequence.accumulate(OutType, io.druid.java.util.common.guava.Accumulator<OutType, T>) or Sequence.toYielder(OutType, io.druid.java.util.common.guava.YieldingAccumulator<OutType, T>) and
Yielder.next(Object) on the wrapped yielder. |
public void before()
Sequence.accumulate(OutType, io.druid.java.util.common.guava.Accumulator<OutType, T>) or Sequence.toYielder(OutType, io.druid.java.util.common.guava.YieldingAccumulator<OutType, T>) on the
wrapped sequence. Default implementation does nothing.public <RetType> RetType wrap(com.google.common.base.Supplier<RetType> sequenceProcessing)
throws Exception
Sequence.accumulate(OutType, io.druid.java.util.common.guava.Accumulator<OutType, T>) or Sequence.toYielder(OutType, io.druid.java.util.common.guava.YieldingAccumulator<OutType, T>) and
Yielder.next(Object) on the wrapped yielder. Doesn't wrap before() and after(boolean, java.lang.Throwable).
sequenceProcessing.get() must be called just once. Implementation of this method should look like
... do something
try {
return sequenceProcessing.get();
}
finally {
... do something else
}
Exceptionpublic void after(boolean isDone,
Throwable thrown)
throws Exception
Sequence.accumulate(OutType, io.druid.java.util.common.guava.Accumulator<OutType, T>) on the wrapped sequence or after Closeable.close() on the wrapped yielder, or if exception was thrown from any method called on the wrapped sequence
or yielder, or from before(), or from wrap(com.google.common.base.Supplier<RetType>) methods of this SequenceWrapper.
Even if thrown is not null, implementation of this method shouldn't rethrow it, it is done outside.
isDone - true if all elements in the sequence were processed and no exception was thrown, false otherwisethrown - an exception thrown from any method called on the wrapped sequence or yielder, or from before(), or from wrap(com.google.common.base.Supplier<RetType>) methods of this SequenceWrapper, or null if no exception was thrown.ExceptionCopyright © 2011–2017. All rights reserved.