Ignore:
Timestamp:
2018-05-22T23:11:11+02:00 (6 years ago)
Author:
donvip
Message:

fix #josm8256, fix #josm14963 - call correct Layer API and implement own ThreadPoolExecutor like Mapillary does

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java

    r33786 r34214  
    3636import java.util.ArrayList;
    3737import java.util.List;
     38import java.util.concurrent.ArrayBlockingQueue;
     39import java.util.concurrent.ThreadPoolExecutor;
     40import java.util.concurrent.TimeUnit;
    3841
    3942import javax.swing.JOptionPane;
     
    7982        MapdustUpdateObserver, MapdustBugObserver {
    8083
     84    /** Executor that will run the updates. */
     85    private static ThreadPoolExecutor executor = new ThreadPoolExecutor(
     86      3, 5, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100), new ThreadPoolExecutor.DiscardPolicy());
     87
    8188    /** The graphical user interface of the plug-in */
    8289    private MapdustGUI mapdustGUI;
     
    532539     */
    533540    private void updatePluginData() {
    534         MainApplication.worker.execute(new Runnable() {
    535             @Override
    536             public void run() {
    537                 updateMapdustData();
    538             }
    539         });
     541        executor.execute(() -> updateMapdustData());
    540542    }
    541543
     
    596598                    /* MapDust data was changed */
    597599                    mapdustGUI.update(mapdustBugList, this);
    598                     mapdustLayer.destroy();
     600                    mapdustLayer.invalidate();
    599601                    mapdustLayer.update(mapdustGUI, mapdustBugList);
    600602                    needRepaint = true;
Note: See TracChangeset for help on using the changeset viewer.