Changeset 12542 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2017-07-30T17:07:42+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java
r12537 r12542 80 80 } 81 81 82 private static final CopyOnWriteArrayList<SoMChangeListener> SOM_CHANGE_LISTENERS= new CopyOnWriteArrayList<>();82 private static final CopyOnWriteArrayList<SoMChangeListener> somChangeListeners = new CopyOnWriteArrayList<>(); 83 83 84 84 /** … … 89 89 */ 90 90 public static void removeSoMChangeListener(SoMChangeListener listener) { 91 SOM_CHANGE_LISTENERS.remove(listener);91 somChangeListeners.remove(listener); 92 92 } 93 93 … … 100 100 public static void addSoMChangeListener(SoMChangeListener listener) { 101 101 if (listener != null) { 102 SOM_CHANGE_LISTENERS.addIfAbsent(listener);102 somChangeListeners.addIfAbsent(listener); 103 103 } 104 104 } 105 105 106 106 protected static void fireSoMChanged(String oldSoM, String newSoM) { 107 for (SoMChangeListener l : SOM_CHANGE_LISTENERS) {107 for (SoMChangeListener l : somChangeListeners) { 108 108 l.systemOfMeasurementChanged(oldSoM, newSoM); 109 109 } -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r12537 r12542 81 81 82 82 83 private static final ConcurrentMap<String, Set<ICachedLoaderListener>> IN_PROGRESS= new ConcurrentHashMap<>();84 private static final ConcurrentMap<String, Boolean> USE_HEAD= new ConcurrentHashMap<>();83 private static final ConcurrentMap<String, Set<ICachedLoaderListener>> inProgress = new ConcurrentHashMap<>(); 84 private static final ConcurrentMap<String, Boolean> useHead = new ConcurrentHashMap<>(); 85 85 86 86 protected final long now; // when the job started … … 162 162 throw new IllegalArgumentException("No url returned"); 163 163 } 164 synchronized ( IN_PROGRESS) {165 Set<ICachedLoaderListener> newListeners = IN_PROGRESS.get(deduplicationKey);164 synchronized (inProgress) { 165 Set<ICachedLoaderListener> newListeners = inProgress.get(deduplicationKey); 166 166 if (newListeners == null) { 167 167 newListeners = new HashSet<>(); 168 IN_PROGRESS.put(deduplicationKey, newListeners);168 inProgress.put(deduplicationKey, newListeners); 169 169 first = true; 170 170 } … … 259 259 private void finishLoading(LoadResult result) { 260 260 Set<ICachedLoaderListener> listeners; 261 synchronized ( IN_PROGRESS) {261 synchronized (inProgress) { 262 262 try { 263 listeners = IN_PROGRESS.remove(getUrl().toString());263 listeners = inProgress.remove(getUrl().toString()); 264 264 } catch (IOException e) { 265 265 listeners = null; … … 312 312 // then just use HEAD request and check returned values 313 313 if (isObjectLoadable() && 314 Boolean.TRUE.equals( USE_HEAD.get(getServerKey())) &&314 Boolean.TRUE.equals(useHead.get(getServerKey())) && 315 315 isCacheValidUsingHead()) { 316 316 LOG.log(Level.FINE, "JCS - cache entry verified using HEAD request: {0}", getUrl()); … … 346 346 LOG.log(Level.INFO, "JCS - Host: {0} found not to return 304 codes for If-Modified-Since or If-None-Match headers", 347 347 serverKey); 348 USE_HEAD.put(serverKey, Boolean.TRUE);348 useHead.put(serverKey, Boolean.TRUE); 349 349 } 350 350 -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r12537 r12542 51 51 // we need another deduplication of Tile Loader listeners, as for each submit, new TMSCachedTileLoaderJob was created 52 52 // that way, we reduce calls to tileLoadingFinished, and general CPU load due to surplus Map repaints 53 private static final ConcurrentMap<String, Set<TileLoaderListener>> IN_PROGRESS= new ConcurrentHashMap<>();53 private static final ConcurrentMap<String, Set<TileLoaderListener>> inProgress = new ConcurrentHashMap<>(); 54 54 55 55 /** … … 71 71 if (listener != null) { 72 72 String deduplicationKey = getCacheKey(); 73 synchronized ( IN_PROGRESS) {74 Set<TileLoaderListener> newListeners = IN_PROGRESS.get(deduplicationKey);73 synchronized (inProgress) { 74 Set<TileLoaderListener> newListeners = inProgress.get(deduplicationKey); 75 75 if (newListeners == null) { 76 76 newListeners = new HashSet<>(); 77 IN_PROGRESS.put(deduplicationKey, newListeners);77 inProgress.put(deduplicationKey, newListeners); 78 78 } 79 79 newListeners.add(listener); … … 162 162 this.attributes = attributes; // as we might get notification from other object than our selfs, pass attributes along 163 163 Set<TileLoaderListener> listeners; 164 synchronized ( IN_PROGRESS) {165 listeners = IN_PROGRESS.remove(getCacheKey());164 synchronized (inProgress) { 165 listeners = inProgress.remove(getCacheKey()); 166 166 } 167 167 boolean status = result.equals(LoadResult.SUCCESS); -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r12536 r12542 47 47 } 48 48 49 private static final AtomicLong ID_COUNTER= new AtomicLong(0);49 private static final AtomicLong idCounter = new AtomicLong(0); 50 50 51 51 /** … … 54 54 */ 55 55 static long generateUniqueId() { 56 return ID_COUNTER.decrementAndGet();56 return idCounter.decrementAndGet(); 57 57 } 58 58 … … 63 63 */ 64 64 public static long currentUniqueId() { 65 return ID_COUNTER.get();65 return idCounter.get(); 66 66 } 67 67 … … 76 76 throw new IllegalArgumentException("Cannot modify the id counter backwards"); 77 77 } 78 ID_COUNTER.set(newId);78 idCounter.set(newId); 79 79 } 80 80 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r12537 r12542 638 638 * dataset. (However, the selection does only change in the active layer) 639 639 */ 640 private static final Collection<SelectionChangedListener> SEL_LISTENERS= new CopyOnWriteArrayList<>();640 private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>(); 641 641 642 642 /** … … 647 647 */ 648 648 public static void addSelectionListener(SelectionChangedListener listener) { 649 ((CopyOnWriteArrayList<SelectionChangedListener>) SEL_LISTENERS).addIfAbsent(listener);649 ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener); 650 650 } 651 651 … … 657 657 */ 658 658 public static void removeSelectionListener(SelectionChangedListener listener) { 659 SEL_LISTENERS.remove(listener);659 selListeners.remove(listener); 660 660 } 661 661 … … 671 671 672 672 private static void fireDreprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) { 673 for (SelectionChangedListener l : SEL_LISTENERS) {673 for (SelectionChangedListener l : selListeners) { 674 674 l.selectionChanged(currentSelection); 675 675 } -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12537 r12542 79 79 private static double griddetail; 80 80 81 private static final Collection<String> IGNORED_ERRORS= new TreeSet<>();81 private static final Collection<String> ignoredErrors = new TreeSet<>(); 82 82 83 83 /** 84 84 * All registered tests 85 85 */ 86 private static final Collection<Class<? extends Test>> ALL_TESTS= new ArrayList<>();87 private static final Map<String, Test> ALL_TESTS_MAP= new HashMap<>();86 private static final Collection<Class<? extends Test>> allTests = new ArrayList<>(); 87 private static final Map<String, Test> allTestsMap = new HashMap<>(); 88 88 89 89 /** … … 139 139 */ 140 140 public static void addTest(Class<? extends Test> testClass) { 141 ALL_TESTS.add(testClass);141 allTests.add(testClass); 142 142 try { 143 ALL_TESTS_MAP.put(testClass.getName(), testClass.getConstructor().newInstance());143 allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance()); 144 144 } catch (ReflectiveOperationException e) { 145 145 Main.error(e); … … 182 182 183 183 private static void loadIgnoredErrors() { 184 IGNORED_ERRORS.clear();184 ignoredErrors.clear(); 185 185 if (ValidatorPreference.PREF_USE_IGNORE.get()) { 186 186 Path path = Paths.get(getValidatorDir()).resolve("ignorederrors"); 187 187 if (path.toFile().exists()) { 188 188 try { 189 IGNORED_ERRORS.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));189 ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8)); 190 190 } catch (final FileNotFoundException e) { 191 191 Main.debug(Main.getErrorMessage(e)); … … 204 204 */ 205 205 public static void addIgnoredError(String s) { 206 IGNORED_ERRORS.add(s);206 ignoredErrors.add(s); 207 207 } 208 208 … … 213 213 */ 214 214 public static boolean hasIgnoredError(String s) { 215 return IGNORED_ERRORS.contains(s);215 return ignoredErrors.contains(s); 216 216 } 217 217 … … 221 221 public static void saveIgnoredErrors() { 222 222 try (PrintWriter out = new PrintWriter(new File(getValidatorDir(), "ignorederrors"), StandardCharsets.UTF_8.name())) { 223 for (String e : IGNORED_ERRORS) {223 for (String e : ignoredErrors) { 224 224 out.println(e); 225 225 } … … 254 254 */ 255 255 public static SortedMap<String, Test> getAllTestsMap() { 256 applyPrefs( ALL_TESTS_MAP, false);257 applyPrefs( ALL_TESTS_MAP, true);258 return new TreeMap<>( ALL_TESTS_MAP);256 applyPrefs(allTestsMap, false); 257 applyPrefs(allTestsMap, true); 258 return new TreeMap<>(allTestsMap); 259 259 } 260 260 … … 271 271 return null; 272 272 } 273 return (T) ALL_TESTS_MAP.get(testClass.getName());273 return (T) allTestsMap.get(testClass.getName()); 274 274 } 275 275 … … 318 318 */ 319 319 public static Collection<Class<? extends Test>> getAllAvailableTestClasses() { 320 return Collections.unmodifiableCollection( ALL_TESTS);320 return Collections.unmodifiableCollection(allTests); 321 321 } 322 322
Note:
See TracChangeset
for help on using the changeset viewer.