Changeset 2896 in josm
- Timestamp:
- 2010-01-27T20:49:59+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r2868 r2896 15 15 public class QuadBuckets<T extends OsmPrimitive> implements Collection<T> 16 16 { 17 p ublicstatic boolean debug = false;18 staticboolean consistency_testing = false;17 private static boolean debug = false; 18 private static final boolean consistency_testing = false; 19 19 /* 20 20 * Functions prefixed with __ need locking before 21 21 * being called. 22 22 */ 23 private Object split_lock = new Object();23 private final Object split_lock = new Object(); 24 24 25 25 static void abort(String s) … … 75 75 init(parent); 76 76 } 77 synchronized boolean remove_content(T o) 78 { 79 boolean ret = this.content.remove(o); 80 if (this.content.size() == 0) { 81 this.content = null; 82 } 83 if (this.canRemove()) { 84 this.remove_from_parent(); 85 } 86 return ret; 77 boolean remove_content(T o) 78 { 79 synchronized (split_lock) { 80 // If two threads try to remove item at the same time from different buckets of this QBLevel, 81 // it might happen that one thread removes bucket but don't remove parent because it still sees 82 // another bucket set. Second thread do the same. Due to thread memory caching, it's possible that 83 // changes made by threads will show up in children array too late, leading to QBLevel with all children 84 // set to null 85 boolean ret = this.content.remove(o); 86 if (this.content.size() == 0) { 87 this.content = null; 88 } 89 if (this.canRemove()) { 90 this.remove_from_parent(); 91 } 92 return ret; 93 } 87 94 } 88 95 QBLevel[] newChildren()
Note:
See TracChangeset
for help on using the changeset viewer.