Search in sources :

Example 6 with InternalTimerService

use of org.apache.flink.streaming.api.operators.InternalTimerService in project flink by apache.

the class CoBroadcastWithKeyedOperator method open.

@Override
public void open() throws Exception {
    super.open();
    InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this);
    TimerService timerService = new SimpleTimerService(internalTimerService);
    collector = new TimestampedCollector<>(output);
    this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size());
    for (MapStateDescriptor<?, ?> descriptor : broadcastStateDescriptors) {
        broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor));
    }
    rwContext = new ReadWriteContextImpl(getExecutionConfig(), getKeyedStateBackend(), userFunction, broadcastStates, timerService);
    rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService);
    onTimerContext = new OnTimerContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService);
}
Also used : SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) InternalTimerService(org.apache.flink.streaming.api.operators.InternalTimerService) TimerService(org.apache.flink.streaming.api.TimerService)

Example 7 with InternalTimerService

use of org.apache.flink.streaming.api.operators.InternalTimerService in project flink by apache.

the class KeyedCoProcessOperator 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);
}
Also used : SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) TimerService(org.apache.flink.streaming.api.TimerService) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) InternalTimerService(org.apache.flink.streaming.api.operators.InternalTimerService)

Aggregations

InternalTimerService (org.apache.flink.streaming.api.operators.InternalTimerService)7 VoidNamespace (org.apache.flink.runtime.state.VoidNamespace)6 TimerService (org.apache.flink.streaming.api.TimerService)4 ArrayList (java.util.ArrayList)3 Arrays (java.util.Arrays)3 Collections (java.util.Collections)3 List (java.util.List)3 BiConsumer (java.util.function.BiConsumer)3 Consumer (java.util.function.Consumer)3 JobID (org.apache.flink.api.common.JobID)3 IntSerializer (org.apache.flink.api.common.typeutils.base.IntSerializer)3 CloseableRegistry (org.apache.flink.core.fs.CloseableRegistry)3 UnregisteredMetricsGroup (org.apache.flink.metrics.groups.UnregisteredMetricsGroup)3 MockEnvironment (org.apache.flink.runtime.operators.testutils.MockEnvironment)3 AbstractKeyedStateBackend (org.apache.flink.runtime.state.AbstractKeyedStateBackend)3 KeyGroupRange (org.apache.flink.runtime.state.KeyGroupRange)3 VoidNamespaceSerializer (org.apache.flink.runtime.state.VoidNamespaceSerializer)3 MemoryStateBackend (org.apache.flink.runtime.state.memory.MemoryStateBackend)3 TtlTimeProvider (org.apache.flink.runtime.state.ttl.TtlTimeProvider)3 SimpleTimerService (org.apache.flink.streaming.api.SimpleTimerService)3