Class ThreadedStreamConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.maven.shared.utils.cli.StreamConsumer

    public final class ThreadedStreamConsumer
    extends java.lang.Object
    implements org.apache.maven.shared.utils.cli.StreamConsumer, java.io.Closeable
    Knows how to reconstruct *all* the state transmitted over stdout by the forked process.
    • Field Detail

      • ITEM_LIMIT_BEFORE_SLEEP

        private static final int ITEM_LIMIT_BEFORE_SLEEP
        See Also:
        Constant Field Values
      • items

        private final java.util.concurrent.BlockingQueue<java.lang.String> items
      • stop

        private final java.util.concurrent.atomic.AtomicBoolean stop
      • thread

        private final java.lang.Thread thread
    • Constructor Detail

      • ThreadedStreamConsumer

        public ThreadedStreamConsumer​(org.apache.maven.shared.utils.cli.StreamConsumer target)
    • Method Detail

      • consumeLine

        public void consumeLine​(java.lang.String s)
        Specified by:
        consumeLine in interface org.apache.maven.shared.utils.cli.StreamConsumer
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • shouldStopQueueing

        private boolean shouldStopQueueing​(java.lang.String item)
        Compared item with END_ITEM by identity.
        Parameters:
        item - element from items
        Returns:
        true if tail of the queue