tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktou Ho <hk...@hotmail.com>
Subject RE: Singleton in Tomcat 6.0 not working
Date Thu, 05 Jun 2008 16:54:35 GMT

I got two objects:
RemoteDBConnections@da4b71
and 
RemoteDBConnections@1f4cbee
 
 
Thanks
Elwin
> Date: Thu, 5 Jun 2008 17:06:00 +0200> From: miki@ceti.pl> To: users@tomcat.apache.org>
Subject: Re: Singleton in Tomcat 6.0 not working> > ktou Ho wrote:> > The problem
I am facing is the Singleton is not working at all in the servlet. I tried to synchnozed the
constructor or make it static. I still get two instances of the objects. How can I solve the
problem? > > > Is anyone able to reproduce this?> > > > public class
RemoteDBConnections> > {> > private static RemoteDBConnections sInstance = new
RemoteDBConnections();> > private static int counter=0;> > > > private RemoteDBConnections()>
> {> > System.out.println("counter =" + (counter++));> > > Add following
line (assuming you do not override default toString method):> > System.out.println(this.toString());>
> and compare results. > > > > -- > Mikolaj Rydzewski <miki@ceti.pl>>
> > ---------------------------------------------------------------------> To start
a new topic, e-mail: users@tomcat.apache.org> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org>
For additional commands, e-mail: users-help@tomcat.apache.org> 
_________________________________________________________________
It’s easy to add contacts from Facebook and other social sites through Windows Live™ Messenger.
Learn how.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message