> more better,
>
> /*
> * Main entrance point to get a hold of the instance
> */
> public static synchronized MySingleton getInstance() {
> return instance;
> }
>
> Append "synchronized" key word.
>
Is the synchronized really needed when the Singleton is declared like
this:
private static MySingleton instance= new MySingleton();
I fully understand the need for it if the instance where created in this
fashion:
-------------------------------------------------------
public static synchronized MySingleton getInstance() {
if(instance == null){
instance = new MySingleton();
}
return instance;
}
-------------------------------------------------------
But when it is declared as a static variable on the class that's created
on Class instantiation time, doesn't that imply that the object must be
fully created before the getInstance() method can get access to it?
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com