Package org.apache.flink.runtime.util
Class StateHandleStoreUtils
- java.lang.Object
-
- org.apache.flink.runtime.util.StateHandleStoreUtils
-
public class StateHandleStoreUtils extends Object
StateHandleStoreUtilscollects utility methods that might be usefule for anyStateHandleStoreimplementation.
-
-
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 passedStateObjectand discards the state in case of failure.
-
-
-
Method Detail
-
serializeOrDiscard
public static byte[] serializeOrDiscard(StateObject stateObject) throws Exception
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>.
-
-