Hi Neil,

Your pool class probably has a static member for the single instance
retrieved by getInstance (), right? If so, this instance is reset only when
the server is restarted or stopped, or when you explicitly release it
yourself.

(By the way, Tomcat maintains a separate classloader for each context (i.e.,
each webapp). Static variables exist within the classloader. This means if
you have multiple contexts, i.e., the same app instantiated several times in
the same Tomcat, you'll have several instances).

Regards,
Ben Flaumenhaft
Principal, Sidelight Consulting
http://www.sidelight.com

----- Original Message -----
From: "Neil Edney" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 01, 2001 2:00 AM
Subject: Life of a class?


> Hi,
>
> We have implemented a database connection pool class (extract below) and
use
> the 'getInstance' method to ensuire that there is only one instance
created
> at any one time.
>
> What we need to know is when will this class be destroyed? Is it went the
> server is stopped (or crashed!) or will it timeout after a period of
> non-use?
>
> Regards,
> Neil
>
>
> public class DbPool extends Object implements java.io.Serializable {
>
>     private static DbPool instance;
>
>     public static DbPool getInstance(){
>         if (instance == null)
>             instance = new DbPool();
>         return instance;
>     }
>
>     /** Creates new dbPool */
>     private DbPool(){
>
>         /** dbPool code */
>
>     }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to