Module org.elasticsearch.compute
Class ExchangeSinkHandler
java.lang.Object
org.elasticsearch.compute.operator.exchange.ExchangeSinkHandler
An
ExchangeSinkHandler receives pages and status from its ExchangeSinks, which are created using
createExchangeSink(Runnable)} method. Pages and status can then be retrieved asynchronously by ExchangeSourceHandlers
using the fetchPageAsync(boolean, ActionListener) method.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExchangeSinkHandler(BlockFactory blockFactory, int maxBufferSize, LongSupplier nowInMillis) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompletionListener(ActionListener<Void> listener) Add a listener, which will be notified when this exchange sink handler is completed.intReturns the number of pages available in the buffer.createExchangeSink(Runnable onPageFetched) Create a new exchange sink for exchanging datavoidfetchPageAsync(boolean sourceFinished, ActionListener<ExchangeResponse> listener) Fetches pages and the sink status asynchronously.booleanReturns true if an exchange is finished
-
Constructor Details
-
ExchangeSinkHandler
-
-
Method Details
-
fetchPageAsync
Fetches pages and the sink status asynchronously.- Parameters:
sourceFinished- if true, then this handler can finish as sources have enough pages.listener- the listener that will be notified when pages are ready or this handler is finished- See Also:
-
addCompletionListener
Add a listener, which will be notified when this exchange sink handler is completed. An exchange sink handler is consider completed when all associated sinks are completed and the output pages are fetched. -
isFinished
public boolean isFinished()Returns true if an exchange is finished -
createExchangeSink
Create a new exchange sink for exchanging data- Parameters:
onPageFetched- aRunnablethat will be called when a page is fetched.- See Also:
-
bufferSize
public int bufferSize()Returns the number of pages available in the buffer. This method should be used for testing only.
-