You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by Dave Roberts <da...@saaconsultants.com> on 2006/01/04 12:50:15 UTC

Adding a FileSystemView.dispose method

I wonder what the list thinks about adding a dispose() method to the
org.apache.ftpserver.ftplet.FileSystemView interface either directly
or by extending org.apache.ftpserver.ftplet.Component.

In an implementation of a file system, there may be per connection
locking or something similar which needs to be cleanly removed when
the connection is dropped.

Currently I have a local modification that adds a dispose to the
FileSystemView interface, which is implemented in both
org.apache.ftpserver.filesystem.NativeFileSystemView and
org.apache.ftpserver.filesystem.OSVirtualFileSystemView as blank
methods.

Then I call the dispose method within the
org.apache.ftpserver.RequestHandler.close() method...

*** RequestHandler.java~        Tue Oct  4 12:31:27 2005
--- RequestHandler.java Wed Dec 14 11:37:32 2005
***************
*** 336,341 ****
--- 336,342 ----
              request.clear();
              request.setObserver(null);
              request.getFtpDataConnection().dispose();
+             request.getFileSystemView().dispose();
              m_request = null;
          }

This nicely cleans up the things I need in my FileSystemView
implementation when the client quits or is timed out.

- Dave.

Re: Adding a FileSystemView.dispose method

Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,

     It is a very good idea. I have commited the
changes. There is one small thing...

FtpRequestImpl.m_fileSystemView will be null until the
login is successfull. The FTP connection can be timed
out even before login. So before calling
FileSystemView.dispose() method we have to do a null
check.

Thanks,
Rana Bhattacharyya



--- Dave Roberts <da...@saaconsultants.com>
wrote:

> I wonder what the list thinks about adding a
> dispose() method to the
> org.apache.ftpserver.ftplet.FileSystemView interface
> either directly
> or by extending
> org.apache.ftpserver.ftplet.Component.
> 
> In an implementation of a file system, there may be
> per connection
> locking or something similar which needs to be
> cleanly removed when
> the connection is dropped.
> 
> Currently I have a local modification that adds a
> dispose to the
> FileSystemView interface, which is implemented in
> both
> org.apache.ftpserver.filesystem.NativeFileSystemView
> and
>
org.apache.ftpserver.filesystem.OSVirtualFileSystemView
> as blank
> methods.
> 
> Then I call the dispose method within the
> org.apache.ftpserver.RequestHandler.close()
> method...
> 
> *** RequestHandler.java~        Tue Oct  4 12:31:27
> 2005
> --- RequestHandler.java Wed Dec 14 11:37:32 2005
> ***************
> *** 336,341 ****
> --- 336,342 ----
>               request.clear();
>               request.setObserver(null);
>              
> request.getFtpDataConnection().dispose();
> +             request.getFileSystemView().dispose();
>               m_request = null;
>           }
> 
> This nicely cleans up the things I need in my
> FileSystemView
> implementation when the client quits or is timed
> out.
> 
> - Dave.
> 



		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com