use of org.apache.flink.runtime.state.VoidNamespace in project flink by apache.
the class BaseTwoInputStreamOperatorWithStateRetention method initializeTimerService.
private void initializeTimerService() {
InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService(TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this);
timerService = new SimpleTimerService(internalTimerService);
}
use of org.apache.flink.runtime.state.VoidNamespace in project flink by apache.
the class LatencyTrackingReducingStateTest method testLatencyTrackingReducingState.
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testLatencyTrackingReducingState() throws Exception {
AbstractKeyedStateBackend<Integer> keyedBackend = createKeyedBackend(getKeySerializer());
try {
LatencyTrackingReducingState<Integer, VoidNamespace, Long> latencyTrackingState = (LatencyTrackingReducingState) createLatencyTrackingState(keyedBackend, getStateDescriptor());
latencyTrackingState.setCurrentNamespace(VoidNamespace.INSTANCE);
LatencyTrackingReducingState.ReducingStateLatencyMetrics latencyTrackingStateMetric = latencyTrackingState.getLatencyTrackingStateMetric();
assertEquals(0, latencyTrackingStateMetric.getAddCount());
assertEquals(0, latencyTrackingStateMetric.getGetCount());
assertEquals(0, latencyTrackingStateMetric.getMergeNamespaceCount());
setCurrentKey(keyedBackend);
ThreadLocalRandom random = ThreadLocalRandom.current();
for (int index = 1; index <= SAMPLE_INTERVAL; index++) {
int expectedResult = index == SAMPLE_INTERVAL ? 0 : index;
latencyTrackingState.add(random.nextLong());
assertEquals(expectedResult, latencyTrackingStateMetric.getAddCount());
latencyTrackingState.get();
assertEquals(expectedResult, latencyTrackingStateMetric.getGetCount());
latencyTrackingState.mergeNamespaces(VoidNamespace.INSTANCE, Collections.emptyList());
assertEquals(expectedResult, latencyTrackingStateMetric.getMergeNamespaceCount());
}
} finally {
if (keyedBackend != null) {
keyedBackend.close();
keyedBackend.dispose();
}
}
}
use of org.apache.flink.runtime.state.VoidNamespace in project flink by apache.
the class KeyedProcessOperator method open.
@Override
public void open() throws Exception {
super.open();
collector = new TimestampedCollector<>(output);
InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this);
TimerService timerService = new SimpleTimerService(internalTimerService);
context = new ContextImpl(userFunction, timerService);
onTimerContext = new OnTimerContextImpl(userFunction, timerService);
}
use of org.apache.flink.runtime.state.VoidNamespace in project flink by apache.
the class LegacyKeyedProcessOperator method open.
@Override
public void open() throws Exception {
super.open();
collector = new TimestampedCollector<>(output);
InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this);
TimerService timerService = new SimpleTimerService(internalTimerService);
context = new ContextImpl(userFunction, timerService);
onTimerContext = new OnTimerContextImpl(userFunction, timerService);
}
use of org.apache.flink.runtime.state.VoidNamespace in project flink by apache.
the class BaseTemporalSortOperator method open.
@Override
public void open() throws Exception {
InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this);
timerService = new SimpleTimerService(internalTimerService);
collector = new TimestampedCollector<>(output);
}
Aggregations