Class InternalTimerServiceImpl<K,​N>

    • Method Detail

      • startTimerService

        public void startTimerService​(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
                                      org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
                                      Triggerable<K,​N> triggerTarget)
        Starts the local InternalTimerServiceImpl by:
        1. Setting the keySerialized and namespaceSerializer for the timers it will contain.
        2. Setting the triggerTarget which contains the action to be performed when a timer fires.
        3. Re-registering timers that were retrieved after recovering from a node failure, if any.

        This method can be called multiple times, as long as it is called with the same serializers.

      • registerProcessingTimeTimer

        public void registerProcessingTimeTimer​(N namespace,
                                                long time)
        Description copied from interface: InternalTimerService
        Registers a timer to be fired when processing time passes the given time. The namespace you pass here will be provided when the timer fires.
        Specified by:
        registerProcessingTimeTimer in interface InternalTimerService<K>
      • registerEventTimeTimer

        public void registerEventTimeTimer​(N namespace,
                                           long time)
        Description copied from interface: InternalTimerService
        Registers a timer to be fired when event time watermark passes the given time. The namespace you pass here will be provided when the timer fires.
        Specified by:
        registerEventTimeTimer in interface InternalTimerService<K>
      • advanceWatermark

        public void advanceWatermark​(long time)
                              throws Exception
        Throws:
        Exception
      • snapshotTimersForKeyGroup

        public InternalTimersSnapshot<K,​N> snapshotTimersForKeyGroup​(int keyGroupIdx)
        Snapshots the timers (both processing and event time ones) for a given keyGroupIdx.
        Parameters:
        keyGroupIdx - the id of the key-group to be put in the snapshot.
        Returns:
        a snapshot containing the timers for the given key-group, and the serializers for them
      • getKeySerializer

        public org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
      • getNamespaceSerializer

        public org.apache.flink.api.common.typeutils.TypeSerializer<N> getNamespaceSerializer()
      • restoreTimersForKeyGroup

        public void restoreTimersForKeyGroup​(InternalTimersSnapshot<?,​?> restoredSnapshot,
                                             int keyGroupIdx)
        Restore the timers (both processing and event time ones) for a given keyGroupIdx.
        Parameters:
        restoredSnapshot - the restored snapshot containing the key-group's timers, and the serializers that were used to write them
        keyGroupIdx - the id of the key-group to be put in the snapshot.
      • numProcessingTimeTimers

        @VisibleForTesting
        public int numProcessingTimeTimers()
      • numEventTimeTimers

        @VisibleForTesting
        public int numEventTimeTimers()
      • numProcessingTimeTimers

        @VisibleForTesting
        public int numProcessingTimeTimers​(N namespace)
      • numEventTimeTimers

        @VisibleForTesting
        public int numEventTimeTimers​(N namespace)