Package org.bsc.async

Class AsyncGeneratorQueue

java.lang.Object
org.bsc.async.AsyncGeneratorQueue

public class AsyncGeneratorQueue extends Object
Represents a queue-based asynchronous generator.
  • Constructor Details

    • AsyncGeneratorQueue

      public AsyncGeneratorQueue()
  • Method Details

    • of

      public static <E, Q extends BlockingQueue<AsyncGenerator.Data<E>>> AsyncGenerator<E> of(Q queue, Consumer<Q> consumer)
      Creates an AsyncGenerator from the provided blocking queue and consumer.
      Type Parameters:
      E - the type of elements in the queue
      Q - the type of blocking queue
      Parameters:
      queue - the blocking queue to generate elements from
      consumer - the consumer for processing elements from the queue
      Returns:
      an AsyncGenerator instance
    • of

      public static <E, Q extends BlockingQueue<AsyncGenerator.Data<E>>> AsyncGenerator<E> of(Q queue, Consumer<Q> consumer, Executor executor)
      Creates an AsyncGenerator from the provided queue, executor, and consumer.
      Type Parameters:
      E - the type of elements in the queue
      Q - the type of blocking queue
      Parameters:
      queue - the blocking queue to generate elements from
      consumer - the consumer for processing elements from the queue
      executor - the executor for asynchronous processing
      Returns:
      an AsyncGenerator instance
    • of

      @Deprecated public static <E, Q extends BlockingQueue<AsyncGenerator.Data<E>>> AsyncGenerator<E> of(Q queue, Executor executor, Consumer<Q> consumer)
      Deprecated.
      use of(Q, Consumer, Executor)
      Creates an AsyncGenerator from the provided queue, executor, and consumer.
      Type Parameters:
      E - the type of elements in the queue
      Q - the type of blocking queue
      Parameters:
      queue - the blocking queue to generate elements from
      executor - the executor for asynchronous processing
      consumer - the consumer for processing elements from the queue
      Returns:
      an AsyncGenerator instance