commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niall Pemberton <niall.pember...@gmail.com>
Subject Re: [io] It seems not possible to control order in which FileAlterationObserver triggers FileAlterationListener when more than one file alteration was detected
Date Fri, 31 Dec 2010 12:47:18 GMT
On Tue, Dec 28, 2010 at 10:51 AM, Damien Tacheron <dtacheron@sqli.com> wrote:
> Hi,
>
> i'm not english native, so i'll do my best.
>
> i need to be triggered by FileAlterationListener for file creation or file
> update, based a timeline :
> - first the first file which was created or updated
> - second, the second fil which was created or updated
> and so on
>
> but, it seems that trigerring was done in alphabetical order and i dont' find
> anything to control this.

You are correct - there is no way to do this.

FileAlterationObserver works by comparing the previous state of a
directory structure with the current state and in order to *match*
files it sorts the contents of each directory on file name to
determine if a file previously existed or has been added or deleted.
As a consequence of that is the behaviour you see - i.e. triggering in
alphabetical order.

There is no straight forward way to do what you want. The file events
would need to be *buffered* in some way and then sorted into time
order before firing the listeners.

Niall

> any idea ?
>
> Best regards
>
>  *Damien Tacheron*
> Chef de projet
> ------------------------------
> SQLI Paris
> standard : 01 55 93 26 00
> ligne directe : 01 55 93 02 51
> <dtacheron@hotmail.fr>
>

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


Mime
View raw message