we can definitly think about making that startup async, perhaps configurable (with default=async to speed thinks up) - those monitoring is mainly to support the resource events. and for a lot of use cases it may not be importing if file changes during the startup phase are not detected.
stefan >-----Original Message----- >From: Roy Teeuwen [mailto:r...@teeuwen.be] >Sent: Friday, September 29, 2017 4:01 PM >To: users@sling.apache.org >Cc: Stefan Seifert >Subject: Re: File system resource provider - Performance > >Hey Carsten, > >What about doing the initial scanning also async? As in that you do the >initial scanning in the first scheduled run, without throwing change events >for that first run > >Greets, >Roy > >> On 29 Sep 2017, at 15:57, Carsten Ziegeler <cziege...@apache.org> wrote: >> >> >> >> >> Stefan Seifert wrote >>> >>>> I think we could try using newer file features from Java 7 which might >>>> make the scanning obsolete. But I've never looked into it. >>> >>> you mean with e.g. this? >>> >https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html >>> >>> i had this on my todo list some time ago for fsresource - but after some >first experiments this seems to behave different depending on the operation >system (windows vs. linux), so i dropped it that time. if someone comes up >with a concept that works reliable on all operation systems i would be glad >to help integrate it in fsresource. >>> >> >> Yes, I agree - this doesn't seem to help (I now remember that I looked >> into it a long time ago). >> >> I'm not sure if this is a good idea, but we could have a switch that >> skips the initial scan and also skips registering the periodic scanners. >> Once a file is accessed we lazily add a scanner for that directory to >> the list. So once a resource/file is used you get change events. If a >> directory is never touched, we don't do anything. >> >> Regards >> Carsten >> -- >> Carsten Ziegeler >> Adobe Research Switzerland >> cziege...@apache.org