View RSS Feed

Design Patterns

Design patterns in Java.

  1. Serialization

    by , 03-09-2012 at 07:50 PM
    If the interface is being implemented by the Singleton class ( when serialization and deserialization of singleton takes place more than one time) then number of Singleton instances will be created. For avoiding this, implement the readResolve method.
    Java Code:
    	public class Singleton implements Serializable {
    		// This method is called immediately after an object of this class is deserialized.
    		// This method returns the singleton instance.
    Singleton Pattern