Thanks for the info. writeObject's behaviour is completely unintuitive.
What's the point of resending objects that have already been sent??
> Thanks for the info. writeObject's behaviour is completely unintuitive.
> What's the point of resending objects that have already been sent??
A series of writeObject()s are intended to write a consistent graph of
objects. When an object is first sent it's assigned an ID: object #1, 2, 3,
etc. If it's sent again, rather than sending the entire object, what's sent
is the information "Here's #12 again". Say the following graph is written:
A->B->C
->C
That is, A points to B and C and B also points to C. A, B, and C are
written once each, together with the information about which points to
which, more or less:
Here's A, it's #1.
Here's B, it's #2.
#1 points to #2.
Here's C, it's #3.
#1 points to #3.
#2 points to #3.
When the result is deserialized, the graph is reconstititued correctly. If,
on the other hand, C had been written each time it was referenced, the
deserialization would create two copies of C, which would be incorrect.
So what you're seeing is that each or your writeObject() calls merely writes
the ID of the object again, rather than reserializing the object. That's
why you don't see the changes.