Class ThreadedStreamConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, EventHandler<Event>

    public final class ThreadedStreamConsumer
    extends java.lang.Object
    implements EventHandler<Event>, java.io.Closeable
    Knows how to reconstruct *all* the state transmitted over Channel by the forked process.
    After applying the performance improvements with ThreadedStreamConsumer.QueueSynchronizer the throughput becomes 6.33 mega messages per second (158 nano seconds per message, 5 million messages within 0.79 seconds - see the test ThreadedStreamConsumerTest) on CPU i5 Dual Core 2.6 GHz and Oracle JDK 11.
    • Constructor Detail

      • ThreadedStreamConsumer

        public ThreadedStreamConsumer​(EventHandler<Event> target)
    • Method Detail

      • 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 static boolean shouldStopQueueing​(Event item)
        Compared item with END_ITEM by identity.
        Parameters:
        item - element from items
        Returns:
        true if tail of the queue