Hello:

I am going to do the similar thing. Do you know where I can find an example
on the net?

Thanks,

Dennis Huang

-----Original Message-----
From: Jacob W Anderson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 29, 2000 4:44 AM
To: [EMAIL PROTECTED]
Subject: Re: beans accessing database pool


Don't forget to add mutex locking around your connection pool object,
otherwise you will have a race condition and end up with multiple instances
of the connection pool.

> class SingletonConnectionPool {
>      private static SingletonConnectionPool  m_conPool = null;

        private static Object _mutex = new Object();  // JWA

>
>      public static getInstance() {

            synchronized(_mutex) {   // JWA

>           if (m_conPool == null)
>                m_conPool = new SingletonConnectionPool();
>

            }   // JWA

>           return m_conPool();
>      }
>
>      private SingletonConnectionPool(...);
> }

==================================
Jacob W Anderson
Software Design & Management Consultant
Arrowhead General Insurance Group
[EMAIL PROTECTED]
(858) 361 2384
=================================

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to