----- Original Message -----
From: "Mikolaj Rydzewski" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Thursday, June 05, 2008 5:06 PM
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?
No, for fun I gave it a spin... it worked, one count
Think ktou is going to have to post his code
Like chuck said, something fishy ;)
On NB its easy to mistakenly set up glassfish as the server - ha ha
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.
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]