Class 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 Detail

      • ContiguousOutputChunker

        public ContiguousOutputChunker​(long min,
                                       long nextRangeMin,
                                       int extentSize,
                                       int maxExtents)
      • ContiguousOutputChunker

        public ContiguousOutputChunker​(Activity activity)
    • Method Detail

      • onCycleResult

        public boolean onCycleResult​(long completedCycle,
                                     int result)
        Description copied from interface: Output
        Mark 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:
        onCycleResult in interface Output
        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
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Output
        Throws:
        java.lang.Exception
      • addExtentReader

        public void addExtentReader​(Output reader)
      • removeExtentReader

        public void removeExtentReader​(Output reader)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object