K - the type of the keypublic class AsyncExecutionController<K> extends Object implements StateRequestHandler
It is responsible for:
MailboxExecutor.yield() to pause current operations,
allowing for the execution of callbacks (mails in Mailbox).| Constructor and Description |
|---|
AsyncExecutionController(org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor,
org.apache.flink.core.state.StateFutureImpl.AsyncFrameworkExceptionHandler exceptionHandler,
StateExecutor stateExecutor,
int maxParallelism,
int batchSize,
long bufferTimeout,
int maxInFlightRecords) |
| Modifier and Type | Method and Description |
|---|---|
RecordContext<K> |
buildContext(Object record,
K key)
Build a new context based on record and key.
|
void |
drainInflightRecords(int targetNum)
A helper function to drain in-flight records util
inFlightRecordNum within the limit
of given targetNum. |
int |
getInFlightRecordNum() |
StateExecutor |
getStateExecutor() |
<IN,OUT> org.apache.flink.core.state.InternalStateFuture<OUT> |
handleRequest(org.apache.flink.api.common.state.v2.State state,
StateRequestType type,
IN payload)
Submit a
StateRequest to this AsyncExecutionController and trigger it if needed. |
void |
processNonRecord(org.apache.flink.util.function.ThrowingRunnable<? extends Exception> action) |
void |
setCurrentContext(RecordContext<K> switchingContext)
Each time before a code segment (callback) is about to run in mailbox (task thread), this
method should be called to switch a context in AEC.
|
void |
syncPointRequestWithCallback(org.apache.flink.util.function.ThrowingRunnable<Exception> callback)
A helper to request a
StateRequestType.SYNC_POINT and run a callback if it finishes
(once the record is not blocked). |
void |
triggerIfNeeded(boolean force)
Trigger a batch of requests.
|
public AsyncExecutionController(org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor,
org.apache.flink.core.state.StateFutureImpl.AsyncFrameworkExceptionHandler exceptionHandler,
StateExecutor stateExecutor,
int maxParallelism,
int batchSize,
long bufferTimeout,
int maxInFlightRecords)
public RecordContext<K> buildContext(Object record, K key)
KeyAccountingUnit.record - the given record.key - the given key.public void setCurrentContext(RecordContext<K> switchingContext)
switchingContext - the context to switch.public <IN,OUT> org.apache.flink.core.state.InternalStateFuture<OUT> handleRequest(@Nullable org.apache.flink.api.common.state.v2.State state, StateRequestType type, @Nullable IN payload)
StateRequest to this AsyncExecutionController and trigger it if needed.handleRequest in interface StateRequestHandlerstate - the state to request. Could be null if the type is StateRequestType.SYNC_POINT.type - the type of this request.payload - the payload input for this request.public void triggerIfNeeded(boolean force)
force - whether to trigger requests in force.public void syncPointRequestWithCallback(org.apache.flink.util.function.ThrowingRunnable<Exception> callback)
StateRequestType.SYNC_POINT and run a callback if it finishes
(once the record is not blocked).callback - the callback to run if it finishes (once the record is not blocked).public void drainInflightRecords(int targetNum)
inFlightRecordNum within the limit
of given targetNum.targetNum - the target inFlightRecordNum to achieve.public void processNonRecord(org.apache.flink.util.function.ThrowingRunnable<? extends Exception> action)
@VisibleForTesting public StateExecutor getStateExecutor()
@VisibleForTesting public int getInFlightRecordNum()
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.