Making the StateFlowGraph serializable enables saving and restoring of the whole graph.
StateFlowGraph is no longer serializable because of class ExitNotifier. I tried to make ExitNotifier serializable (by making it implementing Serializable) however, I got another java.io.NotSerializableException error for class java.util.concurrent.CountDownLatch. I think this issue need to get reopened.
I made all objects related to package java.util.concurrent transient. I Also made InputValue and FormInput implement Serializable. This avoids exception during Serialization. However, lack of lockRead/lockWrite lead to a malformed deserialization. For example, method toString raise exception on deserialized object.
The SFG should actually be a graph; any concurrency logic/code should be moved out of this class.
Our SFG implementation is not serializable and controls the locking/access mechanism to the underlying DirectedGraph<StateVertex, Eventable> which is serializable. If you want to serialize, you can use that object, not the our wrapping SFG.
I am currently serializing sfg field of InMemoryStateFlowGraph. However, I ended up implementing methods like containsVertex, containsEdge, and equals.