Hi, ok that's better indeed. The reason is that according to the spec a
Servlet can be serialized (saved on disk) if the memory becomes low and thus must be able to be loaded back into memory at a later point (the same need for load-balancing).
However your change has introduced another problem: transient means the field will not be saved when the servlet is serialized. Thus when it's deserialized these fields will be null and the code will fail...
Whereas before the servlet would have failed on serialization, it'll now fail on deserialization...
Note: Deserialization will not call the constructor.
I was hoping upon de serialization it will call init() where i initialize these variables. But I can't find a reference that says so (yet).
Solution: either make the field objects serializable or capture deserialization to set up the transient field values. Note that this last solution may potentially cause problems with threading so this might need to be synchronized I think. The best solution is to make the field Objects Serializable IMO.
One instance variable used is provided by jackrabbit library which is not serializable. I can do a custom serialization or, I can create these instance variable for each request (get***) which is a waste. Looking around to see if there is another way. Thanks. - Asiri
WDYT?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs