The AsyncTask base class is a framework that facilitates execution of
operations asynchronously in order to free up the event-handling thread. This
task is passed to an implementation of the AsyncTaskLauncher to be run.
Any code that should be performed in asynchronously with the UI should be put
in the runAsync method. Any code that is run in this method
should NOT modify any Swing components at all. All modifications to Swing
components must either be enqueued on the event-handling thread or performed
in the complete method. If there is any data that must be
passed from the asynchronous step to the completion step, it should be
returned by the runAsync method. The same data returned by the
runAsync method will be given to the complete
method. In short, implementations of an AsyncTask need not manage the
information passing between the task thread and the UI thread.
The runAsync method is given a progress monitor in order for
the task to provide feedback to the user as to the progress of the task. The
min and max values for the progress are specified by the
getMinProgress and getMaxProgress methods in
the task.
author: jlugo |