[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [flux-dev] Status update
|
Hey Fjodor,
the use of the timestamp on the file system level was just a first quick hack to get things going and to find out which version of a resource is newer and/or the same.
As you’ve found out yourself, this is not a reliable way to keep resources in sync at all. A carefully designed system would use something else, like virtual time, based on version numbers and hashes (and probably a history of changes) to identify changes and answer the question who got the newer version. That would be a much better implementation of the syncing.
You can use the additional hack to truncate the millisecond part of System.currentTimeMillis(), but that is juts adding another hack to the hack… ;-)
Cheers,
-Martin
> Am 22.08.2016 um 09:05 schrieb Vershinin Fjodor <fjodor@xxxxxxxxxxxxx>:
>
> Hi!
>
> I hope you are doing extensive testing with all your changes…
>
> Yes, sure, I test all my changes for regressions.
>
> Btw, I have some troubles with time stamp, which I get from file system. Namely, JDK truncates filesystem time stamp up to seconds.
> For example, you can have a look here: http://stackoverflow.com/questions/24804618/get-file-mtime-with-millisecond-resolution-from-java
> There are fix in open-jdk8, however, this patch is still not applied to Oracle JDK.
> So, the main problem is some changes are out of sync, because after truncation some file system changes are traveling to the past.
> It can happen for example when file was deleted very fast.
> I have an idea how to apply quick-fix, namely truncate millisecond part in System.currentTimeMillis(), like here:
> https://github.com/fjodorver/flux/blob/2f5165fa0eac84c32dec9ffddfaa3f64a1a0533f/org.eclipse.flux.watcher/src/main/java/org/eclipse/flux/watcher/fs/JDKProjectWatchService.java#L268
> What do you think?
>
> Fjodor
> _______________________________________________
> flux-dev mailing list
> flux-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/flux-dev