<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: readResolve code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 05 Oct 2008 16:17:10 GMT</pubDate>
    <description>DZone Snippets: readResolve code</description>
    <item>
      <title>Singleton</title>
      <link>http://snippets.dzone.com/posts/show/3519</link>
      <description>The proper way of implementing a Singleton.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public class MySingleton {&lt;br /&gt;    private static final MySingleton INSTANCE = new MySingleton();&lt;br /&gt;&lt;br /&gt;    private MySingleton() {}&lt;br /&gt;&lt;br /&gt;    public static final MySingleton getInstance() {&lt;br /&gt;      return INSTANCE;&lt;br /&gt;    }&lt;br /&gt;	 &lt;br /&gt;	/**&lt;br /&gt;	* Normal deserialization returns a new instance of an object. This ensures that only one instance is in existence. &lt;br /&gt;         * Deserialization can either create a new instance and leave the deserialized object to be garbage collected or&lt;br /&gt;         * reuse the deserialized instance.&lt;br /&gt;	*/&lt;br /&gt;	private Object readResolve() throws ObjectStreamException {&lt;br /&gt;	  return INSTANCE;&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 14 Feb 2007 02:42:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3519</guid>
      <author>wjchay (Chay Weei Jye)</author>
    </item>
  </channel>
</rss>
