Ramprasad D V wrote: > I presume you are saying that the JSch API does not provide the > ability to force close connections on a file and that we need to clean > up the rogue connections outside of the API e.g. directly on the server. I must confess I'm a little confused about the error when the file is open, I guess then this isn't a Unix machine. > It appears to me that an alternative is to skip the deletion attempt > on the files that are found to be open. I am hoping I could use the > Channel.isClosed() method for this. Any ideas please? I think this API is about the ssh communication channel.
You need an OS level command that shows if the file is in use (e.g. lsof), unfortunately there will be a race condition if you try that, as the file might be opened between checking and trying the delete. I suggest you try and delete and catch the failure condition, if it fails then it was open... If you really want to delete files when their open use a Unix machine :) the file will be gone when the process reading it finishes with it... -- Regards, M ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users