@Override public void registerProcessingTimeTimer(long time) { internalTimerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, time); }
@Override public void registerProcessingTimeTimer(long time) { timerService.registerProcessingTimeTimer(window, time); }
@Override public void processElement(StreamRecord<Tuple2<Integer, String>> element) throws Exception { String[] command = element.getValue().f1.split(":"); switch (command[0]) { case "SET_STATE": getPartitionedState(stateDescriptor).update(command[1]); break; case "DELETE_STATE": getPartitionedState(stateDescriptor).clear(); break; case "SET_EVENT_TIME_TIMER": timerService.registerEventTimeTimer(VoidNamespace.INSTANCE, Long.parseLong(command[1])); break; case "SET_PROC_TIME_TIMER": timerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, Long.parseLong(command[1])); break; case "EMIT_STATE": String stateValue = getPartitionedState(stateDescriptor).value(); output.collect(new StreamRecord<>("ON_ELEMENT:" + element.getValue().f0 + ":" + stateValue)); break; default: throw new IllegalArgumentException(); } }
timerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, currentTime + 1);
@Override public void registerProcessingTimeTimer(long time) { internalTimerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, time); }
@Override public void registerProcessingTimeTimer(long time) { internalTimerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, time); }
@Override public void registerProcessingTimeTimer(long time) { internalTimerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, time); }
protected void registerProcessingCleanupTimer(BaseRow key, long currentTime, boolean isLeft, KeyedValueState<BaseRow, Long> timerState) { if (stateCleaningEnabled) { // last registered timer Long curCleanupTime = timerState.get(key); // check if a cleanup timer is registered and // that the current cleanup timer won't delete state we need to keep if (curCleanupTime == null || (currentTime + minRetentionTime) > curCleanupTime) { // we need to register a new (later) timer long cleanupTime = currentTime + maxRetentionTime; // register timer and remember clean-up time byte namespace = (byte) (isLeft ? 1 : 2); internalTimerService.registerProcessingTimeTimer(namespace, cleanupTime); timerState.put(key, cleanupTime); } } }
protected void registerProcessingCleanupTimer(BaseRow key, long currentTime, boolean isLeft, KeyedValueState<BaseRow, Long> timerState) { if (stateCleaningEnabled) { // last registered timer Long curCleanupTime = timerState.get(key); // check if a cleanup timer is registered and // that the current cleanup timer won't delete state we need to keep if (curCleanupTime == null || (currentTime + minRetentionTime) > curCleanupTime) { // we need to register a new (later) timer long cleanupTime = currentTime + maxRetentionTime; // register timer and remember clean-up time byte namespace = (byte) (isLeft ? 1 : 2); internalTimerService.registerProcessingTimeTimer(namespace, cleanupTime); timerState.put(key, cleanupTime); } } }
public void reregisterStateFromLegacyWindowOperator() { // if we restore from an older version, // we have to re-register the recovered state. if (restoredFromLegacyEventTimeTimers != null && !restoredFromLegacyEventTimeTimers.isEmpty()) { LOG.info("{} (taskIdx={}) re-registering event-time timers from an older Flink version.", getClass().getSimpleName(), getRuntimeContext().getIndexOfThisSubtask()); for (Timer<K, W> timer : restoredFromLegacyEventTimeTimers) { setCurrentKey(timer.key); internalTimerService.registerEventTimeTimer(timer.window, timer.timestamp); } } if (restoredFromLegacyProcessingTimeTimers != null && !restoredFromLegacyProcessingTimeTimers.isEmpty()) { LOG.info("{} (taskIdx={}) re-registering processing-time timers from an older Flink version.", getClass().getSimpleName(), getRuntimeContext().getIndexOfThisSubtask()); for (Timer<K, W> timer : restoredFromLegacyProcessingTimeTimers) { setCurrentKey(timer.key); internalTimerService.registerProcessingTimeTimer(timer.window, timer.timestamp); } } // gc friendliness restoredFromLegacyEventTimeTimers = null; restoredFromLegacyProcessingTimeTimers = null; }
@Override public void processElement(StreamRecord<WindowedValue<ValueWithRecordId<T>>> streamRecord) throws Exception { ValueState<Long> dedupingState = getPartitionedState(dedupingStateDescriptor); Long lastSeenTimestamp = dedupingState.value(); if (lastSeenTimestamp == null) { // we have never seen this, emit WindowedValue<ValueWithRecordId<T>> value = streamRecord.getValue(); output.collect(streamRecord.replace(value.withValue(value.getValue().getValue()))); } long currentProcessingTime = timerService.currentProcessingTime(); dedupingState.update(currentProcessingTime); timerService.registerProcessingTimeTimer( VoidNamespace.INSTANCE, currentProcessingTime + MAX_RETENTION_SINCE_ACCESS); }
@Override public void processElement(StreamRecord<WindowedValue<ValueWithRecordId<T>>> streamRecord) throws Exception { ValueState<Long> dedupingState = getPartitionedState(dedupingStateDescriptor); Long lastSeenTimestamp = dedupingState.value(); if (lastSeenTimestamp == null) { // we have never seen this, emit WindowedValue<ValueWithRecordId<T>> value = streamRecord.getValue(); output.collect(streamRecord.replace(value.withValue(value.getValue().getValue()))); } long currentProcessingTime = timerService.currentProcessingTime(); dedupingState.update(currentProcessingTime); timerService.registerProcessingTimeTimer( VoidNamespace.INSTANCE, currentProcessingTime + MAX_RETENTION_SINCE_ACCESS); }
timerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, currentTime + 1);
timerService.registerProcessingTimeTimer(VoidNamespace.INSTANCE, currentTime + 1);