Package org.apache.flink.runtime.util
Class StateHandleStoreUtils
java.lang.Object
org.apache.flink.runtime.util.StateHandleStoreUtils
StateHandleStoreUtils collects utility methods that might be usefule for any StateHandleStore implementation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Serializable>
Tdeserialize(byte[] data) Deserializes the passed data into aRetrievableStateHandle.static byte[]serializeOrDiscard(StateObject stateObject) Serializes the passedStateObjectand discards the state in case of failure.
-
Constructor Details
-
StateHandleStoreUtils
public StateHandleStoreUtils()
-
-
Method Details
-
serializeOrDiscard
Serializes the passedStateObjectand discards the state in case of failure.- Parameters:
stateObject- theStateObjectthat shall be serialized.- Returns:
- The serialized version of the passed
StateObject. - Throws:
Exception- if an error occurred during the serialization. The correspondingStateObjectwill 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
RetrievableStateHandleinstance. - Throws:
IOException- Any of the usual Input/Output related exceptions.ClassNotFoundException- If the data couldn't be deserialized into aRetrievableStateHandlereferring to the expected type<T>.
-