Storing copy of an object
0 posts in topic
Flat View  Flat View

Posted By:   Teena_Pathak
Posted On:   Thursday, September 13, 2007 09:26 AM

How do you store a copy of an object at the same time other threads are changing the object's properties?
Choice 1 Give the thread performing storage a higher priority than other threads.
Choice 2 You do not need to do anything special since all ObjectOutputStream methods are synchronized.
Choice 3 Clone the object in a block synchronized on the object and serialize the clone.
Choice 4 Override writeObject() in ObjectOutputStream to make it synchronized.
Choice 5 Implement java.io.Externalizable instead of java.io.Serializable.

About | Sitemap | Contact