Ignore:
Timestamp:
2017-07-30T17:07:42+02:00 (7 years ago)
Author:
Don-vip
Message:

partial revert of r12537

Location:
trunk/src/org/openstreetmap/josm/data
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r12537 r12542  
    8080    }
    8181
    82     private static final CopyOnWriteArrayList<SoMChangeListener> SOM_CHANGE_LISTENERS = new CopyOnWriteArrayList<>();
     82    private static final CopyOnWriteArrayList<SoMChangeListener> somChangeListeners = new CopyOnWriteArrayList<>();
    8383
    8484    /**
     
    8989     */
    9090    public static void removeSoMChangeListener(SoMChangeListener listener) {
    91         SOM_CHANGE_LISTENERS.remove(listener);
     91        somChangeListeners.remove(listener);
    9292    }
    9393
     
    100100    public static void addSoMChangeListener(SoMChangeListener listener) {
    101101        if (listener != null) {
    102             SOM_CHANGE_LISTENERS.addIfAbsent(listener);
     102            somChangeListeners.addIfAbsent(listener);
    103103        }
    104104    }
    105105
    106106    protected static void fireSoMChanged(String oldSoM, String newSoM) {
    107         for (SoMChangeListener l : SOM_CHANGE_LISTENERS) {
     107        for (SoMChangeListener l : somChangeListeners) {
    108108            l.systemOfMeasurementChanged(oldSoM, newSoM);
    109109        }
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java

    r12537 r12542  
    8181
    8282
    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<>();
    8585
    8686    protected final long now; // when the job started
     
    162162            throw new IllegalArgumentException("No url returned");
    163163        }
    164         synchronized (IN_PROGRESS) {
    165             Set<ICachedLoaderListener> newListeners = IN_PROGRESS.get(deduplicationKey);
     164        synchronized (inProgress) {
     165            Set<ICachedLoaderListener> newListeners = inProgress.get(deduplicationKey);
    166166            if (newListeners == null) {
    167167                newListeners = new HashSet<>();
    168                 IN_PROGRESS.put(deduplicationKey, newListeners);
     168                inProgress.put(deduplicationKey, newListeners);
    169169                first = true;
    170170            }
     
    259259    private void finishLoading(LoadResult result) {
    260260        Set<ICachedLoaderListener> listeners;
    261         synchronized (IN_PROGRESS) {
     261        synchronized (inProgress) {
    262262            try {
    263                 listeners = IN_PROGRESS.remove(getUrl().toString());
     263                listeners = inProgress.remove(getUrl().toString());
    264264            } catch (IOException e) {
    265265                listeners = null;
     
    312312            // then just use HEAD request and check returned values
    313313            if (isObjectLoadable() &&
    314                     Boolean.TRUE.equals(USE_HEAD.get(getServerKey())) &&
     314                    Boolean.TRUE.equals(useHead.get(getServerKey())) &&
    315315                    isCacheValidUsingHead()) {
    316316                LOG.log(Level.FINE, "JCS - cache entry verified using HEAD request: {0}", getUrl());
     
    346346                LOG.log(Level.INFO, "JCS - Host: {0} found not to return 304 codes for If-Modified-Since or If-None-Match headers",
    347347                        serverKey);
    348                 USE_HEAD.put(serverKey, Boolean.TRUE);
     348                useHead.put(serverKey, Boolean.TRUE);
    349349            }
    350350
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r12537 r12542  
    5151    // we need another deduplication of Tile Loader listeners, as for each submit, new TMSCachedTileLoaderJob was created
    5252    // 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<>();
    5454
    5555    /**
     
    7171        if (listener != null) {
    7272            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);
    7575                if (newListeners == null) {
    7676                    newListeners = new HashSet<>();
    77                     IN_PROGRESS.put(deduplicationKey, newListeners);
     77                    inProgress.put(deduplicationKey, newListeners);
    7878                }
    7979                newListeners.add(listener);
     
    162162        this.attributes = attributes; // as we might get notification from other object than our selfs, pass attributes along
    163163        Set<TileLoaderListener> listeners;
    164         synchronized (IN_PROGRESS) {
    165             listeners = IN_PROGRESS.remove(getCacheKey());
     164        synchronized (inProgress) {
     165            listeners = inProgress.remove(getCacheKey());
    166166        }
    167167        boolean status = result.equals(LoadResult.SUCCESS);
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r12536 r12542  
    4747    }
    4848
    49     private static final AtomicLong ID_COUNTER = new AtomicLong(0);
     49    private static final AtomicLong idCounter = new AtomicLong(0);
    5050
    5151    /**
     
    5454     */
    5555    static long generateUniqueId() {
    56         return ID_COUNTER.decrementAndGet();
     56        return idCounter.decrementAndGet();
    5757    }
    5858
     
    6363     */
    6464    public static long currentUniqueId() {
    65         return ID_COUNTER.get();
     65        return idCounter.get();
    6666    }
    6767
     
    7676            throw new IllegalArgumentException("Cannot modify the id counter backwards");
    7777        }
    78         ID_COUNTER.set(newId);
     78        idCounter.set(newId);
    7979    }
    8080
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r12537 r12542  
    638638     * dataset. (However, the selection does only change in the active layer)
    639639     */
    640     private static final Collection<SelectionChangedListener> SEL_LISTENERS = new CopyOnWriteArrayList<>();
     640    private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>();
    641641
    642642    /**
     
    647647     */
    648648    public static void addSelectionListener(SelectionChangedListener listener) {
    649         ((CopyOnWriteArrayList<SelectionChangedListener>) SEL_LISTENERS).addIfAbsent(listener);
     649        ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener);
    650650    }
    651651
     
    657657     */
    658658    public static void removeSelectionListener(SelectionChangedListener listener) {
    659         SEL_LISTENERS.remove(listener);
     659        selListeners.remove(listener);
    660660    }
    661661
     
    671671
    672672    private static void fireDreprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) {
    673         for (SelectionChangedListener l : SEL_LISTENERS) {
     673        for (SelectionChangedListener l : selListeners) {
    674674            l.selectionChanged(currentSelection);
    675675        }
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r12537 r12542  
    7979    private static double griddetail;
    8080
    81     private static final Collection<String> IGNORED_ERRORS = new TreeSet<>();
     81    private static final Collection<String> ignoredErrors = new TreeSet<>();
    8282
    8383    /**
    8484     * All registered tests
    8585     */
    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<>();
    8888
    8989    /**
     
    139139     */
    140140    public static void addTest(Class<? extends Test> testClass) {
    141         ALL_TESTS.add(testClass);
     141        allTests.add(testClass);
    142142        try {
    143             ALL_TESTS_MAP.put(testClass.getName(), testClass.getConstructor().newInstance());
     143            allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance());
    144144        } catch (ReflectiveOperationException e) {
    145145            Main.error(e);
     
    182182
    183183    private static void loadIgnoredErrors() {
    184         IGNORED_ERRORS.clear();
     184        ignoredErrors.clear();
    185185        if (ValidatorPreference.PREF_USE_IGNORE.get()) {
    186186            Path path = Paths.get(getValidatorDir()).resolve("ignorederrors");
    187187            if (path.toFile().exists()) {
    188188                try {
    189                     IGNORED_ERRORS.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));
     189                    ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));
    190190                } catch (final FileNotFoundException e) {
    191191                    Main.debug(Main.getErrorMessage(e));
     
    204204     */
    205205    public static void addIgnoredError(String s) {
    206         IGNORED_ERRORS.add(s);
     206        ignoredErrors.add(s);
    207207    }
    208208
     
    213213     */
    214214    public static boolean hasIgnoredError(String s) {
    215         return IGNORED_ERRORS.contains(s);
     215        return ignoredErrors.contains(s);
    216216    }
    217217
     
    221221    public static void saveIgnoredErrors() {
    222222        try (PrintWriter out = new PrintWriter(new File(getValidatorDir(), "ignorederrors"), StandardCharsets.UTF_8.name())) {
    223             for (String e : IGNORED_ERRORS) {
     223            for (String e : ignoredErrors) {
    224224                out.println(e);
    225225            }
     
    254254     */
    255255    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);
    259259    }
    260260
     
    271271            return null;
    272272        }
    273         return (T) ALL_TESTS_MAP.get(testClass.getName());
     273        return (T) allTestsMap.get(testClass.getName());
    274274    }
    275275
     
    318318     */
    319319    public static Collection<Class<? extends Test>> getAllAvailableTestClasses() {
    320         return Collections.unmodifiableCollection(ALL_TESTS);
     320        return Collections.unmodifiableCollection(allTests);
    321321    }
    322322
Note: See TracChangeset for help on using the changeset viewer.