tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yair Ben-Meir" <yair.ben-m...@sundaysky.com>
Subject RE: multithreaded with taglibs
Date Tue, 27 Nov 2007 07:42:41 GMT
Thanks chris,
The generated output of the JSP is not html and not for an explorer...
that's why it has to be generated along the JSP work.

Btw - i thought of something: maybe the img tag will run a thread, return an
outout to the page with some new image name, and release the jsp to
continue. The thread will do the work and save the new image under the name
the tag returned to the page. At the end of the page, a "wait" tag will be
for waiting to whole of the threads to finish. That's the best thing I
thought of till now.
Thanks
Yair


-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Monday, November 26, 2007 8:44 PM
To: Tomcat Users List
Subject: Re: multithreaded with taglibs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yair,

Yair Ben-Meir wrote:
> You're right about that - it is not for using over the web. Anyway, that's
> just an example. The main issue is to run the work of the tag in a thread
> without making the rest of the page wait.

I think you're hit the nail on the head right there: do the work in a
thread.

FWIW, I think this is an awful idea: if your page renders quickly, the
browser will attempt to load the images before your image threads have a
chance to actually generate the images. The only thing that /might/ work
is to do something like this:

<imageHack:parallel>
    <imageHack:image text="foo" />
    <imageHack:image text="bar" />
</imageHack:parallel>

The "parallel" tag just sets up an environment for the sub tags. Each
sub tag registers a job with the parent. The "end" method for the
parallel tag starts one or more threads to actually create the images,
then calls join() on each one. This will allow the images to be
generated in parallel instead of serial order.

You can't close the output stream of the web page until all of the
images are created, otherwise you risk broken images showing up on the
page. If you don't wrap your image tags in some kind of wrapper
("parallel" in my example), then you can't gather the threads in a sane
way in order to join() on them all.

Again, this sounds awful. Why not use http URLs instead of file urls?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHSxP89CaO5/Lv0PARAmDwAJ9zyDEq/U1LCIRnkLs69v+yMsxJrACgrULl
bH2y/sAsOyQ+IZUbw3aRIzM=
=wAKM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message