singleton « serialize « Java I/O Q&A





1. Serializing ENUM Singleton    stackoverflow.com

I'm trying to serialize an ENUM singleton instance (as described by Joshua Bloch in his book Effective Java) to a file. The ENUM instance is a simple JavaBean as this:

public enum ...

2. Interview question: about Java serialization and singletons    stackoverflow.com

In an interview the interviewer asked me the following question: is it possible to serialize a singleton object? I said yes, but in which scenario should we serialize a singleton? And is ...

3. How to deal with Singleton along with Serialization    stackoverflow.com

Consider I have a Singleton class defined as follows.

public class MySingleton implements Serializable{
 private static MySingleton myInstance;

 private MySingleton(){

 }
  static{
    myInstance =new MySingleton();
 }
 public static ...

4. Effective Java Item #77 - Serialization of singleton objects - Why should I have to use readResolve?    stackoverflow.com

Effective java #77 states that we have to use readResolve to preserve the singleton guarentee during serialization. They have used the example.

public class Elvis implements Serializable{
public static final Elvis INSTANCE = ...

5. Saving a singleton object    stackoverflow.com

I know this site isn't made for questions like this but I've been searching for the answer to this I haven't found anything and I need a confirmations. I have a singleton ...

6. Singletons and Serializable    coderanch.com

Hi Folks, Maybe not a Java puzzler, but here goes. I have a Singleton class X. So that supposedly guarantees only 1 instance per JVM right? But then I have a state manager class that manages the persistence of certain classes based on options and such. One of the classes it serializes is class X. When the program starts again, class ...

8. Serialization of singleton instance    forums.oracle.com