Dear Wiki user,

You have subscribed to a wiki page or wiki category on "River Wiki" for change 
notification.

The "Serialization" page has been changed by PeterFirmstone:
http://wiki.apache.org/river/Serialization?action=diff&rev1=7&rev2=8

  }
  }}}
  
+ === Circularity ===
+ The Serialization Builder takes advantage of the readResolve() method to 
replace itself with a newly built object after the builder is deserialized.  
The java serialization specification describes an issue with circular 
references:
+ 
+ ''Note - The readResolve method is not invoked on the object until the object 
is fully constructed, so any references to this object in its object graph will 
not be updated to the new object nominated by readResolve. However, during the 
serialization of an object with the writeReplace method, all references to the 
original object in the replacement object's object graph are replaced with 
references to the replacement object. Therefore in cases where an object being 
serialized nominates a replacement object whose object graph has a reference to 
the original object, deserialization will result in an incorrect graph of 
objects. Furthermore, if the reference types of the object being read 
(nominated by writeReplace) and the original object are not compatible, the 
construction of the object graph will raise a ClassCastException. ''
+ 
+ [[http://blog.crazybob.org/|Bob Lee]] is credited with the following work 
around:
+ 
+ Have the builder implement the same interface and have it delegate to a 
transient copy of the built object... example soon.
+ 

Reply via email to