It seems to me that locking on the namespace would introduce contention
between multiple repositories if they happen to use the same namespace so I
believe we should not do it.


On Fri, Apr 4, 2014 at 8:11 AM, Gabriel Roldan <notifications@github.com>wrote:

> In
> src/storage/bdbje/src/main/java/org/geogit/storage/bdbje/JEStagingDatabase.java:
>
> > @@ -288,7 +315,10 @@ public boolean processLine(String s) throws IOException {
> >      public void removeConflicts(@Nullable String namespace) {
> >          Optional<File> file = findOrCreateConflictsFile(namespace);
> >          if (file.isPresent()) {
> > -            file.get().delete();
> > +            File f = file.get();
> > +            synchronized (f.getAbsolutePath().intern()) {
>
> no. If the file was deleted between the isPresent() check and our
> File.delete() call then our file.delete() will have no effect, nor side
> effect. What's probably wiser is to have a separate findConflictsFile()method that doesn't create it if it doesn't exist.
> Although for extra safety I think we should synchronize on the namespace
> too, having a constant lock object for the null namespace?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/boundlessgeo/GeoGit/pull/678/files#r11292129>
> .
>



-- 
David Winslow
Boundless - http://boundlessgeo.com/