This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i have to contact a class which uses thread to process . The java class mainly contacts the database and gets me the result set. Say i will be contacting the java class which uses a thread for twice and the main thread needs to print the result returned by the java class. The main thread is the servlet . How to do this ? If i try to make the servlet to wait Exception occurs and if i try to retrive the result set in the servlet i am can get only the empty result set.
I am using a array of resultset in the java class. Suggest me a way how to process this. I need to obtain the result set from the java class in the main Thread that is in the servlet once the 2 threads have completed its execution .
Um, if it doesn't work then you need to act like a programmer and find out what the problem is.
Joined: Mar 05, 2012
Atlast foound the solution. Use join method in thread to make the child threads execute one after the another and store the result in a vector. Once the child threads complete the execution retrive the resultset from the vector.
but i was able to find this one out as i first tried with a seperate app and then included in my project . Thanks Paul for your advice.
No ! What i did is that make the parent thread wait until the child threads have completed the execution. Say you have some 100 child thread and the main thread need to wait until the child thread completes the execution . The child thread executes concurrently boss so there by efficiency will be improved.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com