81 |
private final ExecutorService taskExecutor; |
private final ExecutorService taskExecutor; |
82 |
private final ScheduledExecutorService watchExecutor; |
private final ScheduledExecutorService watchExecutor; |
83 |
|
|
84 |
/** The default interval (milliseconds) for polling the result of a rendering task */ |
// /** The default interval (milliseconds) for polling the result of a rendering task */ |
85 |
public static final long DEFAULT_POLLING_INTERVAL = 100L; |
// public static final long DEFAULT_POLLING_INTERVAL = 300L; |
86 |
|
|
87 |
private long pollingInterval; |
private long pollingInterval; |
88 |
|
|
218 |
* Constructor. Creates a new executor to service the specified map pane. |
* Constructor. Creates a new executor to service the specified map pane. |
219 |
* |
* |
220 |
* @param mapPane the map pane to be serviced |
* @param mapPane the map pane to be serviced |
221 |
|
* @param l |
222 |
*/ |
*/ |
223 |
public RenderingExecutor(final XMapPane mapPane) { |
public RenderingExecutor(final XMapPane mapPane, long pollingInterval) { |
224 |
taskRunning = new AtomicBoolean(false); |
taskRunning = new AtomicBoolean(false); |
225 |
this.mapPane = mapPane; |
this.mapPane = mapPane; |
226 |
taskExecutor = Executors.newSingleThreadExecutor(); |
taskExecutor = Executors.newSingleThreadExecutor(); |
227 |
watchExecutor = Executors.newSingleThreadScheduledExecutor(); |
watchExecutor = Executors.newSingleThreadScheduledExecutor(); |
228 |
pollingInterval = DEFAULT_POLLING_INTERVAL; |
this.pollingInterval = pollingInterval; |
229 |
cancelLatch = new CountDownLatch(0); |
cancelLatch = new CountDownLatch(0); |
230 |
} |
} |
231 |
|
|
277 |
public void run() { |
public void run() { |
278 |
pollTaskResult(); |
pollTaskResult(); |
279 |
} |
} |
280 |
}, DEFAULT_POLLING_INTERVAL, DEFAULT_POLLING_INTERVAL, TimeUnit.MILLISECONDS); |
}, pollingInterval, pollingInterval, TimeUnit.MILLISECONDS); |
281 |
|
|
282 |
return true; |
return true; |
283 |
} |
} |
324 |
case FAILED: |
case FAILED: |
325 |
mapPane.onRenderingFailed(renderingException); |
mapPane.onRenderingFailed(renderingException); |
326 |
break; |
break; |
327 |
|
|
328 |
|
case PENDING: |
329 |
|
mapPane.onRenderingPending(); |
330 |
|
break; |
331 |
|
|
332 |
} |
} |
333 |
} |
} |
334 |
|
|