use of org.apache.flink.streaming.api.operators.sorted.state.BatchExecutionInternalTimeServiceManager in project flink by apache.
the class AbstractPythonFunctionOperator method fireAllRegisteredTimers.
private void fireAllRegisteredTimers(Object newKey) throws Exception {
Field keySelectionListenersField = BatchExecutionKeyedStateBackend.class.getDeclaredField("keySelectionListeners");
keySelectionListenersField.setAccessible(true);
List<KeyedStateBackend.KeySelectionListener<Object>> listeners = (List<KeyedStateBackend.KeySelectionListener<Object>>) keySelectionListenersField.get(getKeyedStateBackend());
for (KeyedStateBackend.KeySelectionListener<Object> listener : listeners) {
if (listener instanceof BatchExecutionInternalTimeServiceManager) {
// fire the registered timers
listener.keySelected(newKey);
// set back the current key
listener.keySelected(getCurrentKey());
}
}
}
use of org.apache.flink.streaming.api.operators.sorted.state.BatchExecutionInternalTimeServiceManager in project flink by apache.
the class StreamGraphGenerator method setBatchStateBackendAndTimerService.
private void setBatchStateBackendAndTimerService(StreamGraph graph) {
boolean useStateBackend = configuration.get(ExecutionOptions.USE_BATCH_STATE_BACKEND);
boolean sortInputs = configuration.get(ExecutionOptions.SORT_INPUTS);
checkState(!useStateBackend || sortInputs, "Batch state backend requires the sorted inputs to be enabled!");
if (useStateBackend) {
LOG.debug("Using BATCH execution state backend and timer service.");
graph.setStateBackend(new BatchExecutionStateBackend());
graph.setChangelogStateBackendEnabled(TernaryBoolean.FALSE);
graph.setCheckpointStorage(new BatchExecutionCheckpointStorage());
graph.setTimerServiceProvider(BatchExecutionInternalTimeServiceManager::create);
} else {
graph.setStateBackend(stateBackend);
graph.setChangelogStateBackendEnabled(changelogStateBackendEnabled);
}
}
Aggregations