Class AsyncQueue<T>
java.lang.Object
io.trino.plugin.hive.util.AsyncQueue<T>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<O> com.google.common.util.concurrent.ListenableFuture<O> borrowBatchAsync(int maxSize, Function<List<T>, AsyncQueue.BorrowResult<T, O>> function) Invokefunctionwith up tomaxSizeelements removed from the head of the queue, and insert elements in the return value to the tail of the queue.voidfinish()getBatchAsync(int maxSize) protected com.google.common.util.concurrent.SettableFuture<Void> booleanReturnstrueif all future attempts to retrieve elements from this queue are guaranteed to return empty.com.google.common.util.concurrent.ListenableFuture<Void> intsize()
-
Field Details
-
executor
-
-
Constructor Details
-
AsyncQueue
-
-
Method Details
-
isFinished
public boolean isFinished()Returnstrueif all future attempts to retrieve elements from this queue are guaranteed to return empty. -
finish
public void finish() -
offer
-
size
public int size() -
getBatchAsync
-
getNotEmptySignal
-
borrowBatchAsync
public <O> com.google.common.util.concurrent.ListenableFuture<O> borrowBatchAsync(int maxSize, Function<List<T>, AsyncQueue.BorrowResult<T, O>> function) Invokefunctionwith up tomaxSizeelements 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
functionwill be deferred until some element is available, or no more elements will be. Spurious invocation offunctionis possible.Insertion through return value of
functionwill be effective even iffinish()has been invoked. When borrow (of a non-empty list) is ongoing,isFinished()will return false. If an empty list is supplied tofunction, it must not return a result indicating intention to insert elements into the queue.
-