|
Here is my scenario. I need to listen to a keyed data queue in Java and once I get a record I need to communicate with a remote server over http.
If
this process takes say 30 seconds there may be an additional 5 data queue entries waiting at that point for processing that were delayed because
the
http communication took so long. It seems like option 2 is the best (though I am not real fond of doing my own thread programming). Are there other methods that I could use that would also be good to consider? Thanks, Aaron Bartell http://mowyourlawn.com --
Aaron, I take it these items appearing on the data queue are requests of some kind that you need to perform some action & reply to? Are the requests independant of each other (i.e. do they need any knowledge of other requests that may be running?) If not, then writing this multi-threaded would be easy since you'll have no locking issues to worry about at all. Just like servlets - they run multi-threaded inside your web server, but because they're independant of each other, you barely even need to be aware of it. Multi-threaded programming only become a real headache when all the threads all need to "fight" over who gets to update which shared variables and lists and who has to wait. The only reason I'm "into" multi-threaded programming at all is its practically essential for dealing with TCP/IP server apps, where you need one thread listening for new connections on the main port, and then spawning off a new thread to deal with each client that connects. Regards, Nigel Gay, Computer Patent Annuities Limited. ******************************************************************************** The information in this message is confidential and may be legally privileged. It is intended solely for the addressee; access to this email by anyone else is unauthorised. If you are not the intended recipient: (1) you are kindly requested to return a copy of this message to the sender indicating that you have received it in error, and to destroy the received copy; and (2) any disclosure or distribution of this message, as well as any action taken or omitted to be taken in reliance on its content, is prohibited and may be unlawful. ********************************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.