-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David,
On 11/16/2009 1:04 PM, David Balažic wrote: > 2009/11/16 Joseph Morgan <joseph.mor...@ignitesales.com>: >> Yes, there is a way, and I suspect you're doing "fire-and-forget" >> processing, but, could you give us a better idea as to what you are >> trying to do? >> >> Tomcat will handle servlet requests in multiple threads if needed, >> anyway. So it may not be necessary. I'm thinking you might want >> to investigate a messaging system, such as OpenMQ. >> >> BTW: To create a thread by hand, look at the Java docs for the >> Thread class and the Runnable interface. Keep in mind, this could >> get really out of hand if there are a lot of requests and you don't >> understand how to properly manage threads in this environment. > > Yes, that is why I ask. (I know how to create threads). I would advise you not to create your own threads. Instead, use a thread pool and queue your jobs into that. 3rd-party thread pools exist, or you can use the ones available in Java 1.5+ in the java.util.concurrent package. You can get started by reading the javadoc for java.util.concurrent.ThreadPoolExecutor and going from there. > So Tomcat has nothing like this in itself? Any trick , shortcut? Nope: Tomcat does not provide any services like this. > It will be something triggered like a few times in an hour and would > take less than a minute to process, to there should be no overload > problems (famous last words...) :) That's why I recommend against managing your own threads: if you do it wrong, you can build a denial-of-service vector into your webapp. Using a managed thread pool can help save you from shooting yourself in the foot. Another option would be to queue the job in a database, then run a completely separate process to go and process them batch-style. This solution can even process jobs that were queued but not processed before you took the server down for some reason. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksBvL4ACgkQ9CaO5/Lv0PDOYACfbdxU+QpIuwSz06Z0c/HHFUjs Pq0An3fNU9rGzjc2YZnFrw4E4TY4ngf7 =xAyX -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org