Should I use a modified singleton design pattern that only allows one reference to its instance?

Posted by Graham on Stack Overflow See other posts from Stack Overflow or by Graham
Published on 2011-01-14T11:21:04Z Indexed on 2011/01/14 11:53 UTC
Read the original article Hit count: 202

Filed under:
|
|

Hi,

I have a class that would normally just generate factory objects, however this class should only used once throughout the program in once specifix place. What is the best design pattern to use in this instance?

I throught that having a modified singleton design which only allows one reference to instance throughout the program would be the correct way to go. So only the first call to getInstance() returns the factory library.

Is this a good or bad idea? Have I missed out another fundermental design pattern for solving this problem?

Thanks for your help.

© Stack Overflow or respective owner

Related posts about java

Related posts about design