Singleton pattern without static
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shyam_Krishnan
Posted On:   Tuesday, October 19, 2004 05:45 AM

Please provide a method to implement Singleton pattern in Java without the usage of static variables/methods.

Re: Singleton pattern without static

Posted By:   Anonymous  
Posted On:   Friday, October 22, 2004 04:10 AM

The static is part is needed because only one instance is allowed to exist. And with that way you can do that in-memory. Without a static method/variable I would try storing the-only instance in a file and use locking, so noone else can change that. Not good, not performant, maybe not even working ... :)

Re: Singleton pattern without static

Posted By:   Anonymous  
Posted On:   Thursday, October 21, 2004 06:13 AM

That's not possible - it wouldn't be the Singleton pattern anymore.
About | Sitemap | Contact