Changeset 29173 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2013-01-06T00:01:47+01:00 (12 years ago)
- 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 106 106 public JMapViewer(TileCache tileCache, int downloadThreadCount) { 107 107 super(); 108 JobDispatcher. WORKER_THREAD_MAX_COUNT = downloadThreadCount;108 JobDispatcher.setMaxWorkers(downloadThreadCount); 109 109 tileSource = new OsmTileSource.Mapnik(); 110 110 tileController = new TileController(tileSource, tileCache, this); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r28505 r29173 12 12 * A generic class that processes a list of {@link Runnable} one-by-one using 13 13 * 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 idle15 * more than {@link # WORKER_THREAD_TIMEOUT} seconds (default: 30), the instance14 * 1 and {@link #workerThreadMaxCount} (default: 8). If an instance is idle 15 * more than {@link #workerThreadTimeout} seconds (default: 30), the instance 16 16 * ends itself. 17 17 * … … 35 35 protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<TileJob>(); 36 36 37 p ublic static int WORKER_THREAD_MAX_COUNT= 8;37 protected static int workerThreadMaxCount = 8; 38 38 39 39 /** … … 43 43 * ignores the timeout and will never terminate itself. 44 44 */ 45 p ublic static int WORKER_THREAD_TIMEOUT= 30;45 protected static int workerThreadTimeout = 30; 46 46 47 47 /** … … 76 76 */ 77 77 static public void setMaxWorkers(int workers) { 78 WORKER_THREAD_MAX_COUNT= workers;78 workerThreadMaxCount = workers; 79 79 } 80 80 … … 105 105 } 106 106 jobQueue.put(job); 107 if (workerThreadIdleCount == 0 && workerThreadCount < WORKER_THREAD_MAX_COUNT)107 if (workerThreadIdleCount == 0 && workerThreadCount < workerThreadMaxCount) 108 108 addWorkerThread(); 109 109 } catch (InterruptedException e) { … … 149 149 job = jobQueue.takeLast(); 150 150 else 151 job = jobQueue.pollLast( WORKER_THREAD_TIMEOUT, TimeUnit.SECONDS);151 job = jobQueue.pollLast(workerThreadTimeout, TimeUnit.SECONDS); 152 152 } else { 153 153 if (firstThread) 154 154 job = jobQueue.take(); 155 155 else 156 job = jobQueue.poll( WORKER_THREAD_TIMEOUT, TimeUnit.SECONDS);156 job = jobQueue.poll(workerThreadTimeout, TimeUnit.SECONDS); 157 157 } 158 158 } catch (InterruptedException e1) {
Note:
See TracChangeset
for help on using the changeset viewer.