At 09:38 AM 12/7/01 -0500, Daniel Popowich wrote:

>Not that I want to beat this to death; I really find this interesting
>and want to share ideas.  Three things...
>
>1.  Thread safety -- it's a noble goal with many benefits once you
>     achieve it.  However, no one will be able to achieve it with
>     typical Webware usage as long as the Page servlet is not
>     thread-safe.  For want of convenience (eg, beging able to call
>     self.response() instead of self.trans().response()) we have lost
>     thread-safety.  I contend that Webware out-of-the-box should be
>     thread-safe.  I would, however, leave the default value returned
>     by Servlet.canBeThreaded() false, so the unsuspecting coder
>     doesn't end up in a mess.

I actually don't see the benefit of thread safety in servlets in 
Webware.  It's really nice to be able to store stuff in instance variables 
during the processing of a request.  WebKit creates new servlet instances 
to handle simultaneous requests.  Where's the big benefit of thread 
safety?  It leads to more convoluted code in many cases, that's for sure.

>2.  I noticed the doc string for Servlet.canBeThreaded() says, "Note:
>     This is not currently used."  Is this true?  Why?  Surely it must
>     be easier NOT to create a new instance for each thread.

I think that comment is out-of-date.  I see code that uses canBeThreaded.

>3.  Instance variables vs. Request fields.  If one is interested in
>     thread safety they should use Request fields.  If an instance
>     can't be thread-safe for some reason or a developer doesn't care
>     if there's a dozen or so instances floating about, then using
>     instance variables is certainly cleaner code (eg, referencing
>     self.x instead of trans().request().field('x'))  Thoughts?

I agree.  For most people, it's easiest to just use the default of 
reuseable and non-threadsafe, in which case you can feel free to store 
stuff in instance variables.


--

- Geoff Talvola
   [EMAIL PROTECTED]

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to