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 classThis synchronization helper mostly avoids the locks. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Threadprivate static final Eventprivate final AtomicBooleanprivate final ThreadedStreamConsumer.Pumperprivate static final intprivate final AtomicBooleanprivate final ThreadedStreamConsumer.QueueSynchronizer<Event> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidhandleEvent(Event event) private static booleanshouldStopQueueing(Event item) Compared item withEND_ITEMby 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:
handleEventin interfaceEventHandler<Event>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
shouldStopQueueing
Compared item withEND_ITEMby identity.- Parameters:
item- element fromitems- Returns:
trueif tail of the queue
-