Package org.apache.flink.runtime.util
Class StateHandleStoreUtils
- java.lang.Object
-
- org.apache.flink.runtime.util.StateHandleStoreUtils
-
public class StateHandleStoreUtils extends Object
StateHandleStoreUtils
collects utility methods that might be usefule for anyStateHandleStore
implementation.
-
-
Constructor Summary
Constructors Constructor Description StateHandleStoreUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Serializable>
Tdeserialize(byte[] data)
Deserializes the passed data into aRetrievableStateHandle
.static byte[]
serializeOrDiscard(StateObject stateObject)
Serializes the passedStateObject
and discards the state in case of failure.
-
-
-
Method Detail
-
serializeOrDiscard
public static byte[] serializeOrDiscard(StateObject stateObject) throws Exception
Serializes the passedStateObject
and discards the state in case of failure.- Parameters:
stateObject
- theStateObject
that shall be serialized.- Returns:
- The serialized version of the passed
StateObject
. - Throws:
Exception
- if an error occurred during the serialization. The correspondingStateObject
will be discarded in that case.
-
deserialize
public static <T extends Serializable> T deserialize(byte[] data) throws IOException, ClassNotFoundException
Deserializes the passed data into aRetrievableStateHandle
.- Type Parameters:
T
- The type of data handled by the deserializedRetrievableStateHandle
.- Parameters:
data
- The data that shall be deserialized.- Returns:
- The
RetrievableStateHandle
instance. - Throws:
IOException
- Any of the usual Input/Output related exceptions.ClassNotFoundException
- If the data couldn't be deserialized into aRetrievableStateHandle
referring to the expected type<T>
.
-
-