public final class AsyncQueues extends Object
AsyncQueue
,
BoundedAsyncQueue
Modifier and Type | Method | Description |
---|---|---|
static <T> BoundedAsyncQueue<T> |
bounded() |
Creates a bounded AsyncQueue.
|
static <T> BoundedAsyncQueue<T> |
buffered(int maxBuffer) |
Creates a buffered AsyncQueue.
|
static <T> AsyncQueue<T> |
unbounded() |
Creates an unbounded AsyncQueue.
|
public static <T> AsyncQueue<T> unbounded()
Sends on an unbounded queue always complete synchronously, and throttling must be managed by
the senders to ensure senders don't get too far ahead of the consumer. See AsyncQueue
for details.
AsyncQueue
AsyncQueue
public static <T> BoundedAsyncQueue<T> bounded()
This queue can only accept one value at a time until it is consumed. This may be useful when
you want to produce work potentially in parallel, but want to be throttled at the rate at which
you can consume this work. See BoundedAsyncQueue
for details.
BoundedAsyncQueue
public static <T> BoundedAsyncQueue<T> buffered(int maxBuffer)
This queue can accept up to maxBuffer
values before the futures returned by send become
delayed. See BoundedAsyncQueue
for details
T
- the type of elements in the returned queuemaxBuffer
- the maximum number of values that the queue will accept before applying
backpressure to sendersBoundedAsyncQueue
with a buffer size of maxBuffer
elementsCopyright © 2018. All rights reserved.