Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Threaded servlets okay in a compliant container?

David Wall

2003-12-30

Replies:

If we use our own connection pools and handle our own transactions
within the db, is there likely any issue with using other threads to do
background tasks that touch the database? I can see there may be issues
in a regular EJB world with declarative transactions and such (does EJB
have its own "self-thread" type of object that can do background tasks
without waiting for a new transaction event to arrive?), but maybe these
are not a real issue with simpler servlets only.

I've found so many of these "annoying" artifacts that it makes one
wonder if anybody had actually tried to create a complete, non-trivial
application using the technology that was standardized. For example,
nearly every data input field (INPUT, TEXTAREA) and all output data for
a JSP/servlet requires that you escape the data being displayed (or
default VALUE aspects for INPUT fields) since it may contain double
quotes or other things that would muck up the HTML if not escaped, so
every field needs to be escaped for display. Background threads are not
necessarily compliant, but how would anybody effect simple policies like
"lock out a user's login for 5 minutes after repeated failures," or
deleting old data in logs, or doing any task every 5 minutes, every day,
once a week, etc.? It seems that everybody who writes a JSP/servlet
application also has to write standalone Java apps to do these things,
which just complicates matters (another process has to be running that's
not part of the servlet environment so it has to start/stop with it,
another application has to access the database using yet another
connection pool, two JVMs means splitting available memory across
multiple JVMs instead of just configuring the max in one, threads can
wake each other up for event processing, but this requires RMI or
another mechanism between two JVMs, etc.)

David


Mike Curwen wrote:

>Just found this while searching for something else...
>
>http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&q=J2CA007
>5W&uid=swg21109248&loc=en_US&cs=utf-8&lang=en+en
>
>It doesn't look related at first, but keep reading the 'Cause' section.
>
>Does anyone know what's the 'real' story regarding threads in servlet
>containers. It seems that what IBM is saying is that "they are
>supported within a transactional context", but I can't find this in the
>newest spec. Did I miss it? (or is it in a broader J2EE spec somewhere?)
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.