|
Heyo, Question #2 for the day. 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. I have a handful of ideas on how to accomplish this task but want to know about any "Best Practices" others have found useful. 1. For each entry received into my Java program create a new job that will go out and do the communication. I don't like this option because I will incur the JVM startup all over again. 2. Implement a Java threading process so that when each entry is read a new thread is spawned within the current job. 3. Starting multiple jobs (say 10 or so) that all listen to the same data queue. This lessens the chance that somebody will have to wait, but it also means that if 10 processes are running (which each is tied to a user interaction) that the 11th person will have to wait until one of the processes complete. 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
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.