Class ContiguousOutputChunker
- java.lang.Object
-
- io.engineblock.activityimpl.marker.ContiguousOutputChunker
-
- All Implemented Interfaces:
Output,java.lang.AutoCloseable
public class ContiguousOutputChunker extends java.lang.Object implements Output
This is the default cycle output implementation for EngineBlock when the input cycles are known to be contiguous.This cycle marker wraps another tracking structure in order to allow for flexible buffering methods. The extents are buffer segments which can be managed atomically. They are chained here in two chains: The marking chain and the tracking chain. When the atomic marking head is non-null, then marking is possible, but marking calls block otherwise. The same is true for the tracking head element.
The nowMarking and nowTracking conditions are meant to be locked and awaited by marking and tracking calls respectively. Conversely, they are expected to be signaled by tracking and marking calls.
This implementation needs to be adapted to onAfterOpStop early exit of either marker or tracker threads with no deadlock.
-
-
Constructor Summary
Constructors Constructor Description ContiguousOutputChunker(long min, long nextRangeMin, int extentSize, int maxExtents)ContiguousOutputChunker(Activity activity)
-
Method Summary
Modifier and Type Method Description voidaddExtentReader(Output reader)voidclose()booleanonCycleResult(long completedCycle, int result)Mark the result of the numbered cycle with an integer value.voidonCycleResultSegment(CycleResultsSegment segment)voidremoveExtentReader(Output reader)java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.engineblock.activityapi.output.Output
onCycleResult
-
-
-
-
Constructor Detail
-
ContiguousOutputChunker
public ContiguousOutputChunker(long min, long nextRangeMin, int extentSize, int maxExtents)
-
ContiguousOutputChunker
public ContiguousOutputChunker(Activity activity)
-
-
Method Detail
-
onCycleResultSegment
public void onCycleResultSegment(CycleResultsSegment segment)
- Specified by:
onCycleResultSegmentin interfaceOutput
-
onCycleResult
public boolean onCycleResult(long completedCycle, int result)Description copied from interface:OutputMark the result of the numbered cycle with an integer value. The meaning of the value provided is contextual to the way it is used. (Each process will have its own status tables, etc.)- Specified by:
onCycleResultin interfaceOutput- Parameters:
completedCycle- The cycle number being marked.result- the result ordinal- Returns:
- true on success, false if the marking should be retried differently
-
close
public void close() throws java.lang.Exception
-
addExtentReader
public void addExtentReader(Output reader)
-
removeExtentReader
public void removeExtentReader(Output reader)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-