- Timestamp:
- 2010-10-04T09:10:46+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r3584 r3588 42 42 * Note that DataSet is not an osm-primitive and so has no key association but a few members to 43 43 * store some information. 44 * 45 * Dataset is threadsafe - accessing Dataset simultaneously from different threads should never 46 * lead to data corruption or ConccurentModificationException. However when for example one thread 47 * removes primitive and other thread try to add another primitive reffering to the removed primitive, 48 * DataIntegrityException will occur. 49 * 50 * To prevent such situations, read/write lock is provided. While read lock is used, it's guaranteed that 51 * Dataset will not change. Sample usage: 52 * <code> 53 * ds.getReadLock().lock(); 54 * try { 55 * // .. do something with dataset 56 * } finally { 57 * ds.getReadLock().unlock(); 58 * } 59 * </code> 60 * 61 * Write lock should be used in case of bulk operations. In addition to ensuring that other threads can't 62 * use dataset in the middle of modifications it also stops sending of dataset events. That's good for performance 63 * reasons - GUI can be updated after all changes are done. 64 * Sample usage: 65 * <code> 66 * ds.beginUpdate() 67 * try { 68 * // .. do modifications 69 * } finally { 70 * ds.endUpdate(); 71 * } 72 * </code> 73 * 74 * Note that it is not necessary to call beginUpdate/endUpdate for every dataset modification - dataset will get locked 75 * automatically. 44 76 * 45 77 * @author imi
Note:
See TracChangeset
for help on using the changeset viewer.