Ignore:
Timestamp:
2013-01-06T00:01:47+01:00 (12 years ago)
Author:
the111
Message:

Second fix for #josm8321 - JMapViewer does not use parameter downloadThreadCount

Location:
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java

    r29171 r29173  
    106106    public JMapViewer(TileCache tileCache, int downloadThreadCount) {
    107107        super();
    108         JobDispatcher.WORKER_THREAD_MAX_COUNT = downloadThreadCount;
     108        JobDispatcher.setMaxWorkers(downloadThreadCount);
    109109        tileSource = new OsmTileSource.Mapnik();
    110110        tileController = new TileController(tileSource, tileCache, this);
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java

    r28505 r29173  
    1212 * A generic class that processes a list of {@link Runnable} one-by-one using
    1313 * one or more {@link Thread}-instances. The number of instances varies between
    14  * 1 and {@link #WORKER_THREAD_MAX_COUNT} (default: 8). If an instance is idle
    15  * more than {@link #WORKER_THREAD_TIMEOUT} seconds (default: 30), the instance
     14 * 1 and {@link #workerThreadMaxCount} (default: 8). If an instance is idle
     15 * more than {@link #workerThreadTimeout} seconds (default: 30), the instance
    1616 * ends itself.
    1717 *
     
    3535    protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<TileJob>();
    3636
    37     public static int WORKER_THREAD_MAX_COUNT = 8;
     37    protected static int workerThreadMaxCount = 8;
    3838
    3939    /**
     
    4343     * ignores the timeout and will never terminate itself.
    4444     */
    45     public static int WORKER_THREAD_TIMEOUT = 30;
     45    protected static int workerThreadTimeout = 30;
    4646
    4747    /**
     
    7676     */
    7777    static public void setMaxWorkers(int workers) {
    78         WORKER_THREAD_MAX_COUNT = workers;
     78        workerThreadMaxCount = workers;
    7979    }
    8080
     
    105105            }
    106106            jobQueue.put(job);
    107             if (workerThreadIdleCount == 0 && workerThreadCount < WORKER_THREAD_MAX_COUNT)
     107            if (workerThreadIdleCount == 0 && workerThreadCount < workerThreadMaxCount)
    108108                addWorkerThread();
    109109        } catch (InterruptedException e) {
     
    149149                            job = jobQueue.takeLast();
    150150                        else
    151                             job = jobQueue.pollLast(WORKER_THREAD_TIMEOUT, TimeUnit.SECONDS);
     151                            job = jobQueue.pollLast(workerThreadTimeout, TimeUnit.SECONDS);
    152152                    } else {
    153153                        if (firstThread)
    154154                            job = jobQueue.take();
    155155                        else
    156                             job = jobQueue.poll(WORKER_THREAD_TIMEOUT, TimeUnit.SECONDS);
     156                            job = jobQueue.poll(workerThreadTimeout, TimeUnit.SECONDS);
    157157                    }
    158158                } catch (InterruptedException e1) {
Note: See TracChangeset for help on using the changeset viewer.