Ignore:
Timestamp:
2017-01-07T09:44:59+01:00 (8 years ago)
Author:
wiktorn
Message:

Fix thread pool for WMS

Because threds in WMS download ThreadPool never died, the unreferenced ThreadPool object (and its threads) was never cleared. To fix this minimum size of ThreadPool was changed to 0.

But due to the fact, that ThreadPoolExecutor spawns new Thread only when workQueue refuses to take a new job, workaround is implemented in HostLimitQueue based on: http://stackoverflow.com/questions/9622599/java-threadpoolexecutor-strategy-direct-handoff-with-queue#

WMS Settings was fixed so now WMS has it's own THREAD_LIMIT setting not connected to JCS default setting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSSettingsPanel.java

    r11287 r11438  
    1313import javax.swing.SpinnerNumberModel;
    1414
    15 import org.openstreetmap.josm.data.imagery.WMSCachedTileLoaderJob;
     15import org.openstreetmap.josm.data.imagery.WMSCachedTileLoader;
    1616import org.openstreetmap.josm.gui.layer.WMSLayer;
    1717import org.openstreetmap.josm.tools.GBC;
     
    4949        add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL));
    5050        JLabel labelSimConn = new JLabel(tr("Simultaneous connections:"));
    51         int threadLimitValue = Utils.clamp(WMSCachedTileLoaderJob.THREAD_LIMIT.get(), THREADS_MIN, THREADS_MAX);
     51        int threadLimitValue = Utils.clamp(WMSCachedTileLoader.THREAD_LIMIT.get(), THREADS_MIN, THREADS_MAX);
    5252        spinSimConn = new JSpinner(new SpinnerNumberModel(threadLimitValue, THREADS_MIN, THREADS_MAX, 1));
    5353        labelSimConn.setLabelFor(spinSimConn);
     
    7171    public void loadSettings() {
    7272        this.autozoomActive.setSelected(WMSLayer.PROP_DEFAULT_AUTOZOOM.get());
    73         this.spinSimConn.setValue(WMSCachedTileLoaderJob.THREAD_LIMIT.get());
     73        this.spinSimConn.setValue(WMSCachedTileLoader.THREAD_LIMIT.get());
    7474        this.tileSize.setValue(WMSLayer.PROP_IMAGE_SIZE.get());
    7575    }
     
    8181    public boolean saveSettings() {
    8282        WMSLayer.PROP_DEFAULT_AUTOZOOM.put(this.autozoomActive.isSelected());
    83         WMSCachedTileLoaderJob.THREAD_LIMIT.put((Integer) spinSimConn.getModel().getValue());
     83        WMSCachedTileLoader.THREAD_LIMIT.put((Integer) spinSimConn.getModel().getValue());
    8484        WMSLayer.PROP_IMAGE_SIZE.put((Integer) this.tileSize.getModel().getValue());
    8585
Note: See TracChangeset for help on using the changeset viewer.