Is writing an object to an ObjectOutputStream a thread-safe operation?
ยท Absolutely not. Serialization, i.e. passing an object reference to the writeObject () method of ObjectOutputStream, is not an atomic operation. Serialization involves traversing a graph of objects, each of which contributes to the state of the object being serialized, saving the state of each object in turn. This is a time-consuming procedure. If other threads are allowed to concurrently access or modify any one of the objects in the graph you could get undefined and unwanted results.