java.lang.Object
org.bsc.async.AsyncGeneratorQueue
Represents a queue-based asynchronous generator.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Inner class to generate asynchronous elements from the queue. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E,
Q extends BlockingQueue<AsyncGenerator.Data<E>>>
AsyncGenerator<E>Deprecated.use of(Q, Consumer, Executor)static <E,
Q extends BlockingQueue<AsyncGenerator.Data<E>>>
AsyncGenerator<E>Creates an AsyncGenerator from the provided blocking queue and consumer.static <E,
Q extends BlockingQueue<AsyncGenerator.Data<E>>>
AsyncGenerator<E>Creates an AsyncGenerator from the provided queue, executor, and consumer.
-
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 queueQ
- the type of blocking queue- Parameters:
queue
- the blocking queue to generate elements fromconsumer
- 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 queueQ
- the type of blocking queue- Parameters:
queue
- the blocking queue to generate elements fromconsumer
- the consumer for processing elements from the queueexecutor
- 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 queueQ
- the type of blocking queue- Parameters:
queue
- the blocking queue to generate elements fromexecutor
- the executor for asynchronous processingconsumer
- the consumer for processing elements from the queue- Returns:
- an AsyncGenerator instance
-