Singleton.

JAVA PRIMER
Using Java Object Serialization: A Few Pitfalls
Huw Evans
Listing 5. Singleton.


public class Singleton implements java.io.Serializable
      {
         private static Singleton s = null;

         private Singleton()
         {
         }

         public static void initialize()
         {
           if(s == null)
             s = new Singleton();
         }

         public static Singleton getSingleton()
         {
           return s;
         }
      }