Module org.apache.arrow.flight.core
Package org.apache.arrow.flight
Class BackpressureStrategy.CallbackBackpressureStrategy
java.lang.Object
org.apache.arrow.flight.BackpressureStrategy.CallbackBackpressureStrategy
- All Implemented Interfaces:
BackpressureStrategy
- Enclosing interface:
- BackpressureStrategy
public static class BackpressureStrategy.CallbackBackpressureStrategy
extends Object
implements BackpressureStrategy
A back pressure strategy that uses callbacks to notify when the client is ready or cancelled.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.arrow.flight.BackpressureStrategy
BackpressureStrategy.CallbackBackpressureStrategy, BackpressureStrategy.WaitResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCallback to execute when the listener is cancelled.voidInterrupt waiting on the listener to change state.protected voidCallback to execute when the listener becomes ready.voidregister(FlightProducer.ServerStreamListener listener) Set up operations to work against the given listener.protected booleanshouldContinueWaiting(FlightProducer.ServerStreamListener listener, long remainingTimeout) Callback function to run to check if the listener should continue to be waited on if it leaves the waiting state without being cancelled, ready, or timed out.waitForListener(long timeout) Waits for the listener to be ready or cancelled up to the given timeout.
-
Constructor Details
-
CallbackBackpressureStrategy
public CallbackBackpressureStrategy()
-
-
Method Details
-
register
Description copied from interface:BackpressureStrategySet up operations to work against the given listener.This must be called exactly once and before any calls to
BackpressureStrategy.waitForListener(long)andOutboundStreamListener.start(VectorSchemaRoot)- Specified by:
registerin interfaceBackpressureStrategy- Parameters:
listener- The listener this strategy applies to.
-
waitForListener
Description copied from interface:BackpressureStrategyWaits for the listener to be ready or cancelled up to the given timeout.- Specified by:
waitForListenerin interfaceBackpressureStrategy- Parameters:
timeout- The timeout in milliseconds. Infinite if timeout is <= 0.- Returns:
- The result of the wait.
-
interruptWait
public void interruptWait()Interrupt waiting on the listener to change state.This method can be used in conjunction with
shouldContinueWaiting(FlightProducer.ServerStreamListener, long)to allow FlightProducers to terminate streams internally and notify clients. -
shouldContinueWaiting
protected boolean shouldContinueWaiting(FlightProducer.ServerStreamListener listener, long remainingTimeout) Callback function to run to check if the listener should continue to be waited on if it leaves the waiting state without being cancelled, ready, or timed out.This method should be used to determine if the wait on the listener was interrupted explicitly using a call to
interruptWait()or if it was woken up due to a spurious wake. -
readyCallback
protected void readyCallback()Callback to execute when the listener becomes ready. -
cancelCallback
protected void cancelCallback()Callback to execute when the listener is cancelled.
-