In the following example,

class ConnectionManager
{
..
  private ConnectionManager(){
  }
  static private ConnectionManager a_instance = null;

  synchronized static public ConnectionManager instance()
  {
    if (a_instance == null) a_instance = new ConnectionManager();
    return a_instance;
  }
...
}

1. Application 1 - JSPPage1

....
<! ConnectionManager aConnectionManager =
                 ConnectionManager.instance();
...

2. Application 1 on webserver1- JSPPage2

....
<! ConnectionManager aConnectionManager =
                 ConnectionManager.instance();
...


3. Application 2 on webserver1 - JSPPage2

....
<! ConnectionManager aConnectionManager =
                 ConnectionManager.instance();
...

1. If I understand the concepts correctly, in all the above cases, we should
get the same instance of the ConnectionManager object.  Or am I missing
something? (ConnectionManager class is in the CLASSPATH of the webserver ).
2. What is the recommended way of doing this?
3. I can put the ConnectionManager in ServletContext() and initialize using
a dummy servlet. What is the difference in this approach?
4. Is there any other way of sharing global data objects?
5. What is the recommended procedure in an OO world?

Thanks in advance
Sree
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

===========================================================================
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

Reply via email to