• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NFS time out

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

I need to implement a timeout in my nfs client that is implemented inside a servlet.
This is my code:

If the nfs server is down the file.exists() method wait for response for a long time.
How can I implement a time out for avoid this.

Thank in advance.

 
Sheriff
Posts: 22788
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll want to include a link to the library you're using next time; you should TellTheDetails. I now got that information from your earlier thread. Not that that got me far, without public Javadoc pages...
 
Frank Hamilton
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Rob, yes I should TellTheDetails.

Inside my servlet I use webnfs and j-ftp for creating a nfs client and access to a remote directory. I need a time out when the nfs server is down but I think this api don't give me any mechanism for me pourpose. Therefore I think any mechanism, maybe a thread.
This is my code:



file.exist() method it's waiting for the connexion and if the nfs is down this method never terminate.

Anybody can help me with this problem?. I think nsf is over tcp protocolo and maybe can use some tcp connector method try to connect with nfs server and if the server is down this method throw a timeout.

TIA
 
Rob Spoor
Sheriff
Posts: 22788
131
Eclipse IDE Spring Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you want to use Callable and Future:

The ExecutorService here is an execute-once-and-discard executor service, but you can replace it by a different executor service, possibly even make it a field or something. For this example this should be enough.
 
Frank Hamilton
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank so much, it's work fine for me now.
 
Rob Spoor
Sheriff
Posts: 22788
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic