Serializing object of class implementing Singleton Pattern

hi ,

if i've a object of a singleton pattern based class and i seriailize that and when i'm desrializing that, i 'll get the object back, but on calling getInstance() method for my singleton class, it will agian call constructor because for the class's static object reference is null, i need to avoid this, for this i've written a setInstance method, which sets the Singleton class's static refernce to the object i desialized, which is fine, but it defeats the singleton pattern

can anybody suggest me some other way of achieving this...

[564 byte] By [gaurav_abbia] at [2007-11-27 0:31:25]
# 1
don't use a singleton, then. I'm serious
georgemca at 2007-7-11 22:35:53 > top of Java-index,Core,Core APIs...
# 2
If you are trying to deserialize a Singleton implement the Object readResolve() method. http://java.sun.com/javase/6/docs/platform/serialization/spec/input.html#5903~Ryan
RyanFa at 2007-7-11 22:35:53 > top of Java-index,Core,Core APIs...