weird tomcat questions

2004-01-08 Thread T K
Can someone please decipher the following questions?

* How does scoping work in Tomcat?

* Why would you bother using a singleton when you're working with Tomcat?

Why would scoping be different in tomcat than any other
servlet-complying container?  What does a singleton have to do
with a web container?
/tk



RE: weird tomcat questions

2004-01-08 Thread Ralph Einfeldt

See below:

 -Original Message-
 From: T K [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 9:03 PM
 To: [EMAIL PROTECTED]
 Subject: weird tomcat questions
 
 
 * How does scoping work in Tomcat?

What kind of scoping do you mean ?
- attribute scoping a la servlet spec ?
  (application, session, request, page)

 * Why would you bother using a singleton when you're working 
 with Tomcat?

The same reason as in any other application.
Tomcat doesn't enforce or restrict the use of singletons
in any way.

 
 Why would scoping be different in tomcat than any other
 servlet-complying container?  

Why should it. After all tomcat is the reference implementation.
Any difference probably spec violation of the other container or
there is a disagreement on the interpretation or something is not
specified in the spec. 
(There may be also errors in tomcat that violate the spec, but
regarding your question I would nearly bet that there are none)

 * What does a singleton have to do with a web container?

Nothing special. They serve the same purpose as in any 
other application

 
 /tk
 
 

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



RE: weird tomcat questions

2004-01-08 Thread Ralph Einfeldt
One thing i forgot in my previous reply:

To implement singletons under tomcat requires more 
knowhow as a typical stand alone applications.
Tomcat has several classloaders and there can a copy 
of the same class in different classloaders. This way 
the simple approach of using static class vars to store 
singletons can fail.

 -Original Message-
 From: T K [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 9:03 PM
 To: [EMAIL PROTECTED]
 Subject: weird tomcat questions
 
 
 Can someone please decipher the following questions?
 
 * How does scoping work in Tomcat?
 
 * Why would you bother using a singleton when you're working 
 with Tomcat?
 
 Why would scoping be different in tomcat than any other
 servlet-complying container?  What does a singleton have to do
 with a web container?
 
 /tk
 
 

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



RE: weird tomcat questions

2004-01-08 Thread Shapira, Yoav

Howdy,

* How does scoping work in Tomcat?

The same as in all java programs.

* Why would you bother using a singleton when you're working with
Tomcat?

Why would scoping be different in tomcat than any other
servlet-complying container?  What does a singleton have to do
with a web container?

You would use a singleton in tomcat for the same reasons you would in
other programs.  One advantage a singleton has in a servlet container
like tomcat is that all the webapps run in one JVM but their own
classloaders, with one common parent classloader.  If your singleton is
in that classloader (the shared or common classloader in tomcat
parlance) then all your webapps see the same instance of this singleton,
thereby making it a suitable location to place objects that you want to
share across webapps.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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