Class ParallelReader

java.lang.Object
java.io.Reader
org.simpleflatmapper.util.ParallelReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class ParallelReader extends Reader
  • Constructor Details

    • ParallelReader

      public ParallelReader(Reader reader)
      Create a new ParallelReader that will fetch the data from that reader in a another thread. By default it will use the ForkJoinPool common pool from java8 or a ExecutorService with a pool size set to the number of available cores. If the number of cores is 1 it will create a new Thread everytime. The default WaitingStrategy just call LockSupport.parkNanos(1l);
      Parameters:
      reader - the reader
    • ParallelReader

      public ParallelReader(Reader reader, Executor executorService)
    • ParallelReader

      public ParallelReader(Reader reader, Executor executorService, int bufferSize)
    • ParallelReader

      public ParallelReader(Reader reader, Executor executorService, int bufferSize, int readBufferSize)
    • ParallelReader

      public ParallelReader(Reader reader, Executor executorService, int bufferSize, int readBufferSize, ParallelReader.WaitingStrategy waitingStrategy)
      Create a new ParallelReader.
      Parameters:
      reader - the reader
      executorService - the executor to fetch from
      bufferSize - the size of the ring buffer
      readBufferSize - the size of the buffer to fetch data
      waitingStrategy - the waiting strategy when the ring buffer is full
  • Method Details