Class QueuedSupplier<T>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<T>, java.util.function.Supplier<T>, AutoFunctional, AutoSupplier<T>

    final class QueuedSupplier<T>
    extends java.lang.Object
    implements AutoSupplier<T>
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  QueuedSupplier.Worker<T>  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.Future<?>[] myFutures  
      private java.util.concurrent.BlockingQueue<T> myQueue  
      private java.util.function.Supplier<T>[] mySuppliers  
    • Constructor Summary

      Constructors 
      Constructor Description
      QueuedSupplier​(java.util.concurrent.ExecutorService executor, java.util.concurrent.BlockingQueue<T> queue, java.util.function.Supplier<T>... suppliers)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      int drainTo​(java.util.Collection<? super T> container, int maxElements)  
      private boolean isDone()  
      T read()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • myFutures

        private final java.util.concurrent.Future<?>[] myFutures
      • myQueue

        private final java.util.concurrent.BlockingQueue<T> myQueue
      • mySuppliers

        private final java.util.function.Supplier<T>[] mySuppliers
    • Constructor Detail

      • QueuedSupplier

        QueuedSupplier​(java.util.concurrent.ExecutorService executor,
                       java.util.concurrent.BlockingQueue<T> queue,
                       java.util.function.Supplier<T>... suppliers)
    • Method Detail

      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface AutoSupplier<T>
        Throws:
        java.lang.Exception
      • drainTo

        public int drainTo​(java.util.Collection<? super T> container,
                           int maxElements)
        Specified by:
        drainTo in interface AutoSupplier<T>
      • isDone

        private boolean isDone()