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 am trying to run a multi threaded application where each thread runs a query (the queries are in a list ) and writes the resultSet to a new file . The task may sometime take 5 hrs to execute i.e. retriving and writing the resultset . When ever I run this application , I see that , the tasks are not getting completed (I mean all the data is not being written ) . I suspect that the threads are getting timedOut while running the database query so application is exiting .
Can any one tell how to increase the timeOut of the threads in executorService , so that I can set the time to 8 hrs and the application would not exit before tasks get completed ?
Threads don't have a timeout associated with them. Neither do the normal methods used for executing tasks in an executor service. I would think the timeout is either Coming from the JDBC driver/ database or from the network appliance used to connect to the server. You probably don't want to keep an open network connection to the server the entire 8 hours, I wouldn't think. What I would do is have your application trigger the long task and tell the server how to contact the application when it is done (like have a socket & IP address the app can listen on). Or maybe have the app start the server working and then check every so often (10 minutes, half an hour,...) to see if the server is done and get the results if it is.
Ravi Tej Pidatala
Joined: Jan 29, 2012
Thanks Steve . It was database exception only . I could get stack trace by using try catch .