Class SequenceWrapper
- java.lang.Object
-
- org.apache.druid.java.util.common.guava.SequenceWrapper
-
public abstract class SequenceWrapper extends Object
-
-
Constructor Summary
Constructors Constructor Description SequenceWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafter(boolean isDone, Throwable thrown)Executed after sequence processing, i.voidbefore()Executed before sequence processing, i.<RetType> RetTypewrap(com.google.common.base.Supplier<RetType> sequenceProcessing)Wraps any bits of the wrapped sequence processing:Sequence.accumulate(OutType, org.apache.druid.java.util.common.guava.Accumulator<OutType, T>)orSequence.toYielder(OutType, org.apache.druid.java.util.common.guava.YieldingAccumulator<OutType, T>)andYielder.next(Object)on the wrapped yielder.
-
-
-
Method Detail
-
before
public void before()
Executed before sequence processing, i. e. beforeSequence.accumulate(OutType, org.apache.druid.java.util.common.guava.Accumulator<OutType, T>)orSequence.toYielder(OutType, org.apache.druid.java.util.common.guava.YieldingAccumulator<OutType, T>)on the wrapped sequence. Default implementation does nothing.
-
wrap
public <RetType> RetType wrap(com.google.common.base.Supplier<RetType> sequenceProcessing)
Wraps any bits of the wrapped sequence processing:Sequence.accumulate(OutType, org.apache.druid.java.util.common.guava.Accumulator<OutType, T>)orSequence.toYielder(OutType, org.apache.druid.java.util.common.guava.YieldingAccumulator<OutType, T>)andYielder.next(Object)on the wrapped yielder. Doesn't wrapbefore()andafter(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 }
-
after
public void after(boolean isDone, Throwable thrown) throws ExceptionExecuted after sequence processing, i. e. afterSequence.accumulate(OutType, org.apache.druid.java.util.common.guava.Accumulator<OutType, T>)on the wrapped sequence or afterCloseable.close()on the wrapped yielder, or if exception was thrown from any method called on the wrapped sequence or yielder, or frombefore(), or fromwrap(com.google.common.base.Supplier<RetType>)methods of this SequenceWrapper.Even if
thrownis not null, implementation of this method shouldn't rethrow it, it is done outside.- Parameters:
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 frombefore(), or fromwrap(com.google.common.base.Supplier<RetType>)methods of this SequenceWrapper, or null if no exception was thrown.- Throws:
Exception
-
-