|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectDefaultRenderingExecutor
public class DefaultRenderingExecutor
The default implementation of RenderingExecutor
which is used by
JMapPane and JLayeredMapPane. It runs no more than
one rendering task at any given time, although that task may involve multiple
threads (e.g. each layer of a map being rendered into separate destinations.
While a task is running any other submitted tasks are rejected.
Whether a rendering task is accepted or rejected can be tested on submission:
taskId = executor.submit(areaToDraw, graphicsToDrawInto);
if (taskId == RenderingExecutor.TASK_REJECTED) {
...
}
While a rendering task is running it is regularly polled to see if it has completed
and, if so, whether it finished normally, was cancelled or failed. The interval between
polling can be adjusted which might be useful to tune the executor for particular
applications:
executor.setPollingInterval( 10 ); // 10 milliseconds
RenderingExecutorListener
Field Summary | |
---|---|
static long |
DEFAULT_POLLING_INTERVAL
The default interval (milliseconds) for polling the result of a rendering task |
Fields inherited from interface RenderingExecutor |
---|
TASK_REJECTED |
Constructor Summary | |
---|---|
DefaultRenderingExecutor()
Creates a new executor. |
Method Summary | |
---|---|
void |
cancel(long taskId)
Cancels a specific rendering task. |
void |
cancelAll()
Since this task can only ever have a single task running, and no tasks queued, this method simply checks for a running task and, if one exists, cancels it. |
long |
getPollingInterval()
Get the interval for polling the result of a rendering task |
boolean |
isShutdown()
Checks whether RenderingExecutor.shutdown() has been called. |
void |
setPollingInterval(long interval)
Set the interval for polling the result of a rendering task |
void |
shutdown()
Stops any current rendering tasks and cleans up resources. |
long |
submit(MapContent mapContent,
GTRenderer renderer,
Graphics2D graphics,
RenderingExecutorListener listener)
Submits a new rendering task to the executor. |
long |
submit(MapContent mapContent,
List<RenderingOperands> operands,
RenderingExecutorListener listener)
Submits a new rendering task to the executor. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_POLLING_INTERVAL
Constructor Detail |
---|
public DefaultRenderingExecutor()
Method Detail |
---|
public long getPollingInterval()
getPollingInterval
in interface RenderingExecutor
public void setPollingInterval(long interval)
setPollingInterval
in interface RenderingExecutor
interval
- interval in milliseconds (values <=
0 are ignored)public long submit(MapContent mapContent, GTRenderer renderer, Graphics2D graphics, RenderingExecutorListener listener)
RenderingExecutor.TASK_REJECTED
instead of a task ID value.
If no rendering task is presently running this new task will be accepted,
otherwise it will be rejected (ie. there is no task queue).
submit
in interface RenderingExecutor
mapContent
- the map content holding the layers to be renderedrenderer
- the renderer to usegraphics
- the graphics object to draw intolistener
- the listener to be notified of task progress
RenderingExecutor.TASK_REJECTED
public long submit(MapContent mapContent, List<RenderingOperands> operands, RenderingExecutorListener listener)
RenderingExecutor
RenderingExecutor.TASK_REJECTED
instead of a task ID value.
submit
in interface RenderingExecutor
mapContent
- the map content holding the layers to be renderedoperands
- operands for each of the sub-tasks composing this tasklistener
- the listener to be notified of task progress
RenderingExecutor.TASK_REJECTED
public void cancel(long taskId)
cancel
in interface RenderingExecutor
taskId
- the ID value of the taskpublic void cancelAll()
cancelAll
in interface RenderingExecutor
public void shutdown()
shutdown
in interface RenderingExecutor
public boolean isShutdown()
RenderingExecutor.shutdown()
has been called.
isShutdown
in interface RenderingExecutor
true
if the executor has been shut down
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |