• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

FileReader TimeOut help  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone! I hope someone can help me!

I'm working in an application which needs to read a txt file over the network (is an application running in a client and the file is in a server). I noticed that, when I'm having network problems, the application hangs and I get the gray window.
Checking about this I found that the problem was because of a FileReader that was looking for the file while disconnected from the network. Is there any way to set up de FileReader's timeout, so it lasts no more than 4 seconds?

Thank you so much!
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I could think of the only way to add pause to FileReader - to create separate thread, which will watch reading time and report timeouts. For example, like this (for simplicity i overrode only read() method):

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!