On Thu, Jun 30, 2011 at 4:09 PM,  <[email protected]> wrote:
> Code snippet from the FileWatcher
>
>    public boolean isModified() {
>        long now = System.currentTimeMillis();
>        if((now - lastCheck) > 1000) {
>            lastCheck = now;
>            stale = file.exists() && (file.lastModified() != lastModified);
>        }
>        return stale;
>    }
>
> The check interval is 1000 ms. Unfortunately, my JUNIT tests are too fast,
> so I modified the file, want to check the modifications, but  isModified
> returns false and my tests fail. Doing a sleep(2000) makes the tests happy
> again, but I do not want to slow down the tests.
>
> What about a property (with getter and setter, default = 1000)
> milliSecsBetweenChecks
>
> Simple exercise, I would test and commit.

Works for me. The reason to have a non 0 delay is that otherwise the benchmarks
against GeoServer (or any high load) would be slowed down significantly, those
checks are quite expensive and, if I remember properly, also have some
internal synchronization
(I guess due to the native code call).

Cheers
Andrea

-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to