Class StateFutureUtils


  • @Experimental
    public class StateFutureUtils
    extends Object
    A collection of utilities that expand the usage of StateFuture. All the methods can only be accessed within user function provided to KeyedStream.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> org.apache.flink.api.common.state.v2.StateFuture<Collection<T>> combineAll​(Collection<? extends org.apache.flink.api.common.state.v2.StateFuture<? extends T>> futures)
      Creates a future that is complete once multiple other futures completed.
      static <V> org.apache.flink.api.common.state.v2.StateFuture<V> completedFuture​(V result)
      Returns a completed future that does nothing and return provided result.
      static <V> org.apache.flink.api.common.state.v2.StateFuture<V> completedVoidFuture()
      Returns a completed future that does nothing and return null.
      static <T> org.apache.flink.api.common.state.v2.StateFuture<Iterable<T>> toIterable​(org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.api.common.state.v2.StateIterator<T>> future)
      Convert a future of state iterator to a future of iterable.
    • Constructor Detail

      • StateFutureUtils

        public StateFutureUtils()
    • Method Detail

      • completedVoidFuture

        public static <V> org.apache.flink.api.common.state.v2.StateFuture<V> completedVoidFuture()
        Returns a completed future that does nothing and return null.
      • completedFuture

        public static <V> org.apache.flink.api.common.state.v2.StateFuture<V> completedFuture​(V result)
        Returns a completed future that does nothing and return provided result.
      • combineAll

        public static <T> org.apache.flink.api.common.state.v2.StateFuture<Collection<T>> combineAll​(Collection<? extends org.apache.flink.api.common.state.v2.StateFuture<? extends T>> futures)
        Creates a future that is complete once multiple other futures completed. Upon successful completion, the future returns the collection of the futures' results.
        Parameters:
        futures - The futures that make up the conjunction. No null entries are allowed, otherwise a IllegalArgumentException will be thrown.
        Returns:
        The StateFuture that completes once all given futures are complete.
      • toIterable

        public static <T> org.apache.flink.api.common.state.v2.StateFuture<Iterable<T>> toIterable​(org.apache.flink.api.common.state.v2.StateFuture<org.apache.flink.api.common.state.v2.StateIterator<T>> future)
        Convert a future of state iterator to a future of iterable. There is no good reason to do so, since this may disable the capability of lazy loading. Only useful when the further calculation depends on the whole data from the iterator.