Class StateHandleStoreUtils


  • public class StateHandleStoreUtils
    extends Object
    StateHandleStoreUtils collects utility methods that might be usefule for any StateHandleStore implementation.
    • Constructor Detail

      • StateHandleStoreUtils

        public StateHandleStoreUtils()
    • Method Detail

      • serializeOrDiscard

        public static byte[] serializeOrDiscard​(StateObject stateObject)
                                         throws Exception
        Serializes the passed StateObject and discards the state in case of failure.
        Parameters:
        stateObject - the StateObject that shall be serialized.
        Returns:
        The serialized version of the passed StateObject.
        Throws:
        Exception - if an error occurred during the serialization. The corresponding StateObject will be discarded in that case.
      • deserialize

        public static <T extends Serializable> T deserialize​(byte[] data)
                                                      throws IOException,
                                                             ClassNotFoundException
        Deserializes the passed data into a RetrievableStateHandle.
        Type Parameters:
        T - The type of data handled by the deserialized RetrievableStateHandle.
        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 a RetrievableStateHandle referring to the expected type <T>.