Hello,
Is there any particular reason you can't just use ServletContext Attribute instead of a static singleton?

Greetings, Lilianne E. Blaze

ktou Ho wrote:
Hi,
I am using Tomcat 6.0.16 with JDK 1.6. I created a web application and deployed it as ROOT. (I removed the default ROOT which comes with tomcat). 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? e.g.
=======
public class RemoteDBConnections
{
    private static RemoteDBConnections sInstance = new RemoteDBConnections();
    private static int counter=0;
private RemoteDBConnections()
    {
        System.out.println("counter =" + (counter++));
}; public static synchronized RemoteDBConnections getInstance()
    {
        return sInstance;
    }
}
======
Thanks in advance
Elwin
_________________________________________________________________
Search that pays you back! Introducing Live Search cashback.
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=srchpaysyouback


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to