You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ken Tanaka <Ke...@noaa.gov> on 2008/03/24 18:01:25 UTC

Re: [vfs] SFTP program not exiting - solution


Ken.Tanaka@noaa.gov wrote:
>  I'm trying to automate the downloading of data from a remote SFTP
> server using VFS. My program gets the files, but doesn't exit, it seems
> to hang. It's not clear what cleanup steps I should be doing after
> accessing files. I haven't found any VFS + SFTP examples or tutorials.
>   
Sorry for the double posting, delivery errors and a failure of email 
filters made it look like the original post didn't go through.

I did discover a solution though: one needs to cast the 
FileSystemManager to the DefaultFileSystemManager which then gives 
access to a no-argument close() method that does what I need. My release 
method from the sample code now works as:


    public void release() {
        ((DefaultFileSystemManager) this.fsManager).close();
    } // release()


See 
http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/impl/DefaultFileSystemManager.html#close()

Thanks to a posting at 
http://osdir.com/ml/jakarta.commons.user/2003-11/msg00079.html by Morus 
Walter for cluing me in.

-Ken

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org