ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ws Wiki] Update of "FrontPage/Axis2/MessageContextSaveRestore" by AnnRobinson
Date Tue, 31 Oct 2006 21:17:10 GMT
Dear Wiki user,

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

The following page has been changed by AnnRobinson:
http://wiki.apache.org/ws/FrontPage/Axis2/MessageContextSaveRestore

------------------------------------------------------------------------------
  
  === Considerations for Using or Implementing Serialization ===
  
+ 1. Sending the same object again: if you send the same                     
+ object more than once into the same output stream, it isn't actually sent. 
+ The first copy makes it into the stream but subsequent copies (even with   
+ modified fields) do not.  Either close the stream after a write or reset   
+ the stream to flush the entire object cache.  Or, clone the object, modify 
+ the clone and send a copy of the clone to the stream.                      
+                                                                            
+ 2. Performance: the default serialization/de-serialization mechanism in    
+ Java is not the best performer.                                            
+                                                                            
+ 3. Special cases like circular references and multiple references to a     
+ single object need to be preserved such that when the object is            
+ re-created, the object tree graph doesn't cause new objects to be created  
+ where a reference to an existing object in the tree should be.             
+                                                                            
+ 4. Use javadoc @serial tag to identify serializable fields when using      
+ java.io.Serializable.                                                      
+                                                                            
+ 5. When serializing a Collection, store the number of objects in the       
+ Collection and use the number to read them back when de-serializing.       
+                                                                            
+ 6. The JVM may limit the class depth.  The class depth refers to the       
+ number of objects in the object tree graph for the object to be serialized.
+                                                                            
+ 7. Unexpected constructor firing: if the superclass of a serialized        
+ object does not implement java.io.Serializable, its default constructor    
+ (and not the serialized object's) will fire upon being de-serialized.  The 
+ simplest solution to prevent the superclass's constructor from firing is   
+ to have the superclass implement java.io.Serializable.  There does not     
+ seem to be a good explanation for this behavior.                           
+                                                                            
+ 8. To correctly externalize an object, the field data must be read back    
+ in the same order and type as it was written.  Consider using a revision   
+ number, in addition to the serialVersionUID.                               
+                                                                            
+ 
+ 9. Incompatible changes while evolving a class include
+  a. Deleting fields                  
+  a. Moving classes up or down in the hierarchy
+  a. Changing a non-static field to static or a non-transient field to transient
+  a. Changing the declared type of a primitive field
+  a. Changing the class from Serializable to Externalizable
+  a. Removing Serializable or Externalizable from the class
+  a. Changing a class from a non-enum type to an enum type or vice versa
+                                                                                
+ 10. If your strings might contain more than 64k characters, you will have 
+ to customize your serialization. Refer to the java.io.DataOutput interface
+ and the writeUTF() method.                                                
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@ws.apache.org
For additional commands, e-mail: general-help@ws.apache.org


Mime
View raw message