Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads getting timeout with out finishing tasks(using ExecutorService )

 
Ravi Tej Pidatala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,



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 ?

thanks in advance .
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve . It was database exception only . I could get stack trace by using try catch .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic