mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "seventyboy@virgilio.it" <seventy...@virgilio.it>
Subject R: Re: locking files while being downloaded
Date Wed, 30 Oct 2013 11:11:23 GMT
why don't you implement a file locking mechanism ? it's the better and simplest solution

----Messaggio originale----
Da: genti.tech@gmail.com
Data: 22-ott-2013 15.29
A: <dev@mina.apache.org>
Ogg: Re: locking files while being downloaded

The afterCommand will execute at the end rather. My issue is while a user
is downloading the file, I do not want another connection to download it
for  a second time.

At the end of the download we intend to remove the successfully downloaded
files so that will take care of a second download anyway.

You are right though, an Ftplet should handle this.

Thank you,


On Tue, Oct 22, 2013 at 7:41 AM, Dave Roberts <
dave.roberts@saaconsultants.com> wrote:

> On 21/10/2013 21:15, Gentian Hila wrote:
> > Is there any way to make sure that when one file is downloaded from the
> > user, a second connection from the same user won't be able to download it
> > again?
>
> An Ftplet implementation should be able to handle this.
>
> You could physically move/remove the file in the afterCommand
> method, but that would mean that only 1 user ever downloads the
> file.  The advantage is that you've nothing further to monitor.
>
> Alternatively you could monitor the downloads per user with some map
> field, as you suggest.  You can add to this when afterCommand is
> passed a 226 (as per your other query from yesterday).  Then in the
> beforeCommand method, you check if the file already exists in the
> map for that user.  Or to lock the file, add the reference in the
> beforeCommand, and remove it on failure in the afterCommand.
>
> The user information can be obtained from the FtpSession passed in
> to both methods.
>
> Obviously you'll need some means of expiring entries from the Map
> otherwise it will grow continually.
>
> Anything more elaborate (like filtering out the downloaded file
> names from any file listing), you'll need to provide your own
> FileSystemFactory etc. implementation or extend the existing Native one.
>


   
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message