G1 GC: Garbage First (G1) is a parallel, concurrent, and compacting GC algorithm that is designed to provide high throughput and low latency. It divides the heap into regions and performs GC on each region separately. It is suitable for large applications with a large amount of data and can handle applications with mixed types of objects.
These are the import definitions. As might be noticed from the imports' statements, we have the import of the Publisher from the original Reactive Streams library and the import of the Flow, which is the access point to all interfaces of Reactive Streams, but ported to JDK 9.
This is the Flow.Publisher instance definition. Here we define the instance of Publisher from the JDK 9. In turn, at point (2.1), we use the FlowAdapters.toPublisher method from the original Reactive Streams library to convert Flow.Publisher to org.reactivestreams.Publisher. Also, for demo purposes, at line (2.2) we use the FlowAdapters.toFlowPublisher method to convert org.reactivestreams.Publisher back to Flow.Publisher.
G1 GC: Garbage First (G1) is a parallel, concurrent, and compacting GC algorithm that is designed to provide high throughput and low latency. It divides the heap into regions and performs GC on each region separately. It is suitable for large applications with a large amount of data and can handle applications with mixed types of objects.