Class ThreadedStreamConsumer
java.lang.Object
org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer
- All Implemented Interfaces:
Closeable
,AutoCloseable
,EventHandler<Event>
Knows how to reconstruct *all* the state transmitted over Channel by the forked process.
After applying the performance improvements with
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
(package private) final class
(package private) static class
This synchronization helper mostly avoids the locks. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Thread
private static final Event
private final AtomicBoolean
private final ThreadedStreamConsumer.Pumper
private static final int
private final AtomicBoolean
private final ThreadedStreamConsumer.QueueSynchronizer<Event>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
handleEvent
(Event event) private static boolean
shouldStopQueueing
(Event item) Compared item withEND_ITEM
by identity.
-
Field Details
-
QUEUE_MAX_ITEMS
private static final int QUEUE_MAX_ITEMS- See Also:
-
END_ITEM
-
synchronizer
-
stop
-
isAlive
-
consumer
-
pumper
-
-
Constructor Details
-
ThreadedStreamConsumer
-
-
Method Details
-
handleEvent
- Specified by:
handleEvent
in interfaceEventHandler<Event>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
shouldStopQueueing
Compared item withEND_ITEM
by identity.- Parameters:
item
- element fromitems
- Returns:
true
if tail of the queue
-