• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Problem with run method in thread  RSS feed

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everyone. I am newbie to java. I have a problem concerning threads.
I havewritten some code that will read from an html file and extract information adn then update an excel spreadsheet. The problem I am now having is that I do not wish the thread to exit if there is an exception throw. Rather I wish for it to wait a specified amount of time and then try the process again.

The relevent code is as follows:

I apologize if the code (which I am sure it is) is hard to understand. Ultimately what I wish to accomplish is to have the run method continue to execute even if there is an exception thrown. I have not included it here but where an exception would be thrown I would log the errors in a file.
As it stands the refresInterval variable is set to 15 minutes. And so every 15 minutes I update my excel spreadsheet. If however the line

throws ans exception the variable runit is set to false and the application halts (I don't want this).
I thought that I could solve this problem by not setting the variable to runit to false and setting the refreshInterval to 5 minutes for example for the applucation to start the entire process once again.

Some help would be greatlty appreciated as I am new to the topic of threads.
(Sorry if my explanations are not as clear as they should be).
Thank you in advance.
Posts: 43009
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you saying that even if you remove all "runit = false" statements the tread terminates if an exception is thrown? That would be odd. You're catching InfoException - maybe the exception that is happening is a different one?
Have you no shame? Have you no decency? Have you no tiny ad?
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!