public class StateUtil extends Object
StateObject
related code.Modifier and Type | Method and Description |
---|---|
static void |
bestEffortDiscardAllStateObjects(Iterable<? extends StateObject> handlesToDiscard)
Iterates through the passed state handles and calls discardState() on each handle that is not
null.
|
static void |
discardStateFuture(Future<? extends StateObject> stateFuture)
Discards the given state future by first trying to cancel it.
|
static long |
getStateSize(StateObject handle)
Returns the size of a state object.
|
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. |
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. |
public static long getStateSize(StateObject handle)
handle
- The handle to the retrieved statepublic static void bestEffortDiscardAllStateObjects(Iterable<? extends StateObject> handlesToDiscard) throws Exception
handlesToDiscard
- State handles to discard. Passed iterable is allowed to deliver null
values.Exception
- exception that is a collection of all suppressed exceptions that were
caught during iterationpublic static void discardStateFuture(Future<? extends StateObject> stateFuture) throws Exception
stateFuture
- to be discardedException
- if the discard operation failedpublic static RuntimeException unexpectedStateHandleException(Class<? extends StateObject> expectedStateHandleClass, Class<? extends StateObject> actualStateHandleClass)
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.public static RuntimeException unexpectedStateHandleException(Class<? extends StateObject>[] expectedStateHandleClasses, Class<? extends StateObject> actualStateHandleClass)
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.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.