T - The type of elements accepted by the queue.@ThreadSafe public class ThrottledAsyncQueue<T> extends AsyncQueue<T>
AsyncQueue.BorrowResult<T,R>| Constructor and Description |
|---|
ThrottledAsyncQueue(int maxBatchSizePerSec,
int targetQueueSize,
Executor executor) |
| Modifier and Type | Method and Description |
|---|---|
<O> com.google.common.util.concurrent.ListenableFuture<O> |
borrowBatchAsync(int maxSize,
Function<List<T>,AsyncQueue.BorrowResult<T,O>> function)
Invoke
function with up to maxSize elements removed from the head of the queue,
and insert elements in the return value to the tail of the queue. |
finish, getBatchAsync, getNotEmptySignal, isFinished, offer, sizepublic ThrottledAsyncQueue(int maxBatchSizePerSec,
int targetQueueSize,
Executor executor)
public <O> com.google.common.util.concurrent.ListenableFuture<O> borrowBatchAsync(int maxSize,
Function<List<T>,AsyncQueue.BorrowResult<T,O>> function)
AsyncQueuefunction with up to maxSize elements removed from the head of the queue,
and insert elements in the return value to the tail of the queue.
If no element is currently available, invocation of function will be deferred until some
element is available, or no more elements will be. Spurious invocation of function is
possible.
Insertion through return value of function will be effective even if AsyncQueue.finish() has been invoked.
When borrow (of a non-empty list) is ongoing, AsyncQueue.isFinished() will return false.
If an empty list is supplied to function, it must not return a result indicating intention
to insert elements into the queue.
borrowBatchAsync in class AsyncQueue<T>Copyright © 2012–2020. All rights reserved.