wood burning stoves*
The moose likes Threads and Synchronization and the fly likes Questions of how to divide the query processing with Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Questions of how to divide the query processing with Thread" Watch "Questions of how to divide the query processing with Thread" New topic
Author

Questions of how to divide the query processing with Thread

Marco Paradiso
Greenhorn

Joined: Aug 09, 2010
Posts: 11
Good evening,

I have an application that need to see some information in the database. They are about 12 queries that will be fired.
But this bank is very slow and sometimes this process can take up to 1 minute to complete. The time required would be around 15 seconds.
To answer this question, I chose to create some threads so that queries were processed in parallel and at the end, the results would be assigned to an object.
Never had the need to implement something like that and I've been doing some studies to verify the best cool.
I created an example that someone could tell me if the path is correct or wrong.
Below is an example.

Class to process the Threads.
The returned values ​​are calculated by generating a result.



Class that returns an integer.



Class that returns a double



To facilitate the analysis of the result, one thread to put her to sleep for 10 seconds. This made ​​it much easier for me to have an idea of how fast it was.
I hope I've been clear in explaining and I'm very grateful if anyone can help me with this issue because my primary need right now is to get the application to work as soon as possible.

Tranks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions of how to divide the query processing with Thread
 
Similar Threads
how to make sure the program is time consuming
wait and notifyAll
Threads behave in sequential Style
Converting threadgroup to executorservice
problem on: passing parameter that it only reads as null for every value