2

I am using java program to read/write files in a server which is accessible to many others.

I want to make sure that if somebody will not get any error while accessing the file.

I have one solution to create locking mechanism which can avoid concurrency issue but problem is that i don't have permission to run scripts on the server or check anything.

This is very common problem but i am not able to find the exact solution for this.

Bhavesh
  • 882
  • 2
  • 9
  • 18
  • there seem to exist open source libraries for sftp access e.g. http://stackoverflow.com/questions/2346764/java-sftp-transfer-library, why don't you use them? – John Donn Oct 06 '16 at 11:44
  • Thanks ... Does it handle concurrent scenario also – Bhavesh Oct 06 '16 at 11:52
  • I made the comment since it is a commonplace that if a library for a specific task exists, it is usually better to use the library to avoid common pitfalls (and then googling I found the library). However, I just found this link https://github.com/NLeSC/Xenon/issues/171, from which I cite "I've looked into the Jsch code (following the stacktrace) and what it comes down to is that the synchronization inside Jsch is seriously broken." – John Donn Oct 06 '16 at 12:56
  • They have also mentioned one more library sshj, https://github.com/shikhar/sshj in the same thread. I think i can try this to use. – Bhavesh Oct 06 '16 at 13:14

0 Answers0