You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Johan Lindquist <jo...@kawoo.co.uk> on 2004/06/15 16:34:49 UTC

[VFS] Using sftp and vfs ...

Hi,

I am using the VFS library to connect to a remote SFTP server and it is  
working fine but it seems there is a thread hanging in the jsch libraries  
(assuming it is the SSH session) ... Even if I call close on the file  
objects the thread doesn't stop - is there another way to shut down the  
remote jsch session?

Thanks,

Johan

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


Re: [VFS] Using sftp and vfs ...

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Yes, sounds good - cause I was just thinking that what if I have two users  
concurrently calling the VFS.getManager(), do some operation and then  
close the FileSystemManager, there is a chance one of them will get their  
session closed half-way through the operation?  cleanup would definately  
be a better option.

On Wed, 16 Jun 2004 11:50:44 +0200, Mario Ivankovits <im...@apache.org>  
wrote:

> Johan Lindquist wrote:
>
>> Would it be possible though to have a file system option that would   
>> determine if the session is to be closed if all files are detached for   
>> example?  I have not had a chance to look in detail 'under the hood'  
>> of  VFS yet, so i don't know if this is possible.
>
> This is exactly what i am thinking about.
> Maybe a method called "cleanup" on the manager which will free unused  
> resources (in opposite to close which will close and free all resources).
>



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


Re: [VFS] Using sftp and vfs ...

Posted by Mario Ivankovits <im...@apache.org>.
Johan Lindquist wrote:

> Would it be possible though to have a file system option that would  
> determine if the session is to be closed if all files are detached 
> for  example?  I have not had a chance to look in detail 'under the 
> hood' of  VFS yet, so i don't know if this is possible.

This is exactly what i am thinking about.
Maybe a method called "cleanup" on the manager which will free unused 
resources (in opposite to close which will close and free all resources).

-- 
Mario


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


Re: [VFS] Using sftp and vfs ...

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Thanks for that Mario, will give that a go as that is pretty much the  
scenario i am using it right now - connect, do some file op and  
disconnect, possibly reconnecting later as a different user ...

Would it be possible though to have a file system option that would  
determine if the session is to be closed if all files are detached for  
example?  I have not had a chance to look in detail 'under the hood' of  
VFS yet, so i don't know if this is possible.

Thanks,

Johan

On Tue, 15 Jun 2004 21:21:57 +0200, Mario Ivankovits <im...@apache.org>  
wrote:

> Johan Lindquist wrote:
>
>> I am using the VFS library to connect to a remote SFTP server and it  
>> is  working fine but it seems there is a thread hanging in the jsch  
>> libraries  (assuming it is the SSH session) ... Even if I call close on  
>> the file  objects the thread doesn't stop - is there another way to  
>> shut down the  remote jsch session?
>
>
> I know, this is not a solution (and maybe not even a workaround for you)  
> - the trick is to close the FileSystemManager, if you use  
> VFS.getManager() you could cast the returned FileSystemManager and then  
> close it. Maybe you instantiate VFS in some other way, however it should  
> be possible to cast anyway.
>
>         StandardFileSystemManager fsm = (StandardFileSystemManager)  
> VFS.getManager();
>         fsm.close();
>
> But this will close all files and resources allocated by this instance  
> !!!
>
> I will have a look how to do this more general (and maybe  
> automatically), but this might take a while.
>
> --
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>



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


Re: [VFS] Using sftp and vfs ...

Posted by Mario Ivankovits <im...@apache.org>.
Johan Lindquist wrote:

> I am using the VFS library to connect to a remote SFTP server and it 
> is  working fine but it seems there is a thread hanging in the jsch 
> libraries  (assuming it is the SSH session) ... Even if I call close 
> on the file  objects the thread doesn't stop - is there another way to 
> shut down the  remote jsch session?


I know, this is not a solution (and maybe not even a workaround for you) 
- the trick is to close the FileSystemManager, if you use 
VFS.getManager() you could cast the returned FileSystemManager and then 
close it. Maybe you instantiate VFS in some other way, however it should 
be possible to cast anyway.

        StandardFileSystemManager fsm = (StandardFileSystemManager) 
VFS.getManager();
        fsm.close();

But this will close all files and resources allocated by this instance !!!

I will have a look how to do this more general (and maybe 
automatically), but this might take a while.

--
Mario


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