Hi,
You could make the getInstance method synchronized
which would of
course makes the execution of this block slower. Also
not sure if it
*actually* helps much but you could check out Double
checked locking
idiom too.
--
Radz
devashish bajpai wrote:
>i have a proble i have made a class SingleTon .. i
use it in many places in my project .. but just have
relised that the calss is creating more intances
...the code is as following ....
>
>
>public class LogManager
> {
> private java.io.PrintStream m_out;
>
> private LogManager( PrintStream out )
> {
> m_out = out;
> }
>
> public void log( String msg )
> {
> System.out.println( msg );
> }
> static private LogManager sm_instance;
> static public LogManager getInstance()
> {
> if ( sm_instance == null )
> sm_instance = new LogManager( System.out
);
> return sm_instance;
> }
> }
>
>and using it like this ...
>
>LogManager.getInstance().log( "some message" );
>
>
>what sud i do ??
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing