261 |
* rejected |
* rejected |
262 |
*/ |
*/ |
263 |
public synchronized boolean submit(ReferencedEnvelope envelope, Rectangle paintArea, Graphics2D graphics, final GTRenderer renderer) { |
public synchronized boolean submit(ReferencedEnvelope envelope, Rectangle paintArea, Graphics2D graphics, final GTRenderer renderer) { |
264 |
if (!isRunning() || cancelLatch.getCount() > 0) { |
if (!isRunning()) { |
265 |
try { |
// try { |
266 |
// wait for any cancelled task to finish its shutdown |
// // wait for any cancelled task to finish its shutdown |
267 |
cancelLatch.await(); |
// cancelLatch.await(); |
268 |
} catch (InterruptedException ex) { |
// } catch (InterruptedException ex) { |
269 |
return false; |
// return false; |
270 |
} |
// } |
271 |
|
|
272 |
task = new Task(envelope, paintArea, graphics, renderer); |
task = new Task(envelope, paintArea, graphics, renderer); |
273 |
taskRunning.set(true); |
taskRunning.set(true); |
291 |
public synchronized void cancelTask() { |
public synchronized void cancelTask() { |
292 |
if (isRunning()) { |
if (isRunning()) { |
293 |
task.cancel(); |
task.cancel(); |
294 |
cancelLatch = new CountDownLatch(1); |
|
295 |
|
// Cancelling to often... can that be the reason? |
296 |
|
if (cancelLatch.getCount() < 1) { |
297 |
|
cancelLatch = new CountDownLatch(1); |
298 |
|
} |
299 |
} |
} |
300 |
} |
} |
301 |
|
|
347 |
watchExecutor.shutdownNow(); |
watchExecutor.shutdownNow(); |
348 |
} |
} |
349 |
} |
} |
350 |
|
|
351 |
|
public void dispose() { |
352 |
|
taskExecutor.shutdownNow(); |
353 |
|
watchExecutor.shutdownNow(); |
354 |
|
} |
355 |
} |
} |
356 |
|
|