Class StateUtil

    • Method Detail

      • getStateSize

        public static long getStateSize​(StateObject handle)
        Returns the size of a state object.
        Parameters:
        handle - The handle to the retrieved state
      • bestEffortDiscardAllStateObjects

        public static void bestEffortDiscardAllStateObjects​(Iterable<? extends StateObject> handlesToDiscard)
                                                     throws Exception
        Iterates through the passed state handles and calls discardState() on each handle that is not null. All occurring exceptions are suppressed and collected until the iteration is over and emitted as a single exception.
        Parameters:
        handlesToDiscard - State handles to discard. Passed iterable is allowed to deliver null values.
        Throws:
        Exception - exception that is a collection of all suppressed exceptions that were caught during iteration
      • discardStateObjectQuietly

        public static void discardStateObjectQuietly​(StateObject stateObject)
      • discardStateFuture

        public static Tuple2<Long,​Long> discardStateFuture​(Future<? extends StateObject> stateFuture)
                                                          throws Exception
        Discards the given state future by first trying to cancel it. If this is not possible, then the state object contained in the future is calculated and afterwards discarded.
        Parameters:
        stateFuture - to be discarded
        Returns:
        the size of state before cancellation (if available)
        Throws:
        Exception - if the discard operation failed
      • unexpectedStateHandleException

        public static RuntimeException unexpectedStateHandleException​(Class<? extends StateObject> expectedStateHandleClass,
                                                                      Class<? extends StateObject> actualStateHandleClass)
        Creates an RuntimeException that signals that an operation did not get the type of StateObject that was expected. This can mostly happen when a different StateBackend from the one that was used for taking a checkpoint/savepoint is used when restoring.
      • unexpectedStateHandleException

        public static RuntimeException unexpectedStateHandleException​(Class<? extends StateObject>[] expectedStateHandleClasses,
                                                                      Class<? extends StateObject> actualStateHandleClass)
        Creates a RuntimeException that signals that an operation did not get the type of StateObject that was expected. This can mostly happen when a different StateBackend from the one that was used for taking a checkpoint/savepoint is used when restoring.