Class ATask
java.lang.Object
javax.swing.SwingWorker<java.lang.Void,java.lang.Integer>
org.sm.smtools.application.concurrent.ATask
- All Implemented Interfaces:
java.lang.Runnable
,java.util.concurrent.Future<java.lang.Void>
,java.util.concurrent.RunnableFuture<java.lang.Void>
public abstract class ATask
extends javax.swing.SwingWorker<java.lang.Void,java.lang.Integer>
The
ATask
class provides the basic functionality for a task.
Derived classes must implement the executeTask()
and finishTask()
methods.
Note that this is an abstract class.
- Version:
- 17/06/2014
- Author:
- Sven Maerivoet
- See Also:
TaskExecutor
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.SwingWorker
javax.swing.SwingWorker.StateValue
-
Constructor Summary
Constructors Constructor Description ATask()
Constructs anATask
object. -
Method Summary
Modifier and Type Method Description protected java.lang.Void
doInBackground()
protected void
done()
protected abstract void
executeTask()
This method is called when the task is executed.protected abstract void
finishTask()
This method is called when the task has finished.void
installCountDownLatch(java.util.concurrent.CountDownLatch countDownLatch)
Installs theCountDownLatch
that is used to synchronise this task.void
installProgressUpdateGlassPane(JProgressUpdateGlassPane progressUpdateGlassPane)
Installs theAJProgressUpdateGlassPane
that is used for progress updates of this task.protected void
process(java.util.List<java.lang.Integer> chunks)
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, publish, removePropertyChangeListener, run, setProgress
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ATask
public ATask()Constructs anATask
object.
-
-
Method Details
-
installCountDownLatch
public final void installCountDownLatch(java.util.concurrent.CountDownLatch countDownLatch)Installs theCountDownLatch
that is used to synchronise this task.- Parameters:
countDownLatch
- theCountDownLatch
to use for synchronisation
-
installProgressUpdateGlassPane
Installs theAJProgressUpdateGlassPane
that is used for progress updates of this task.- Parameters:
progressUpdateGlassPane
- theJProgressUpdateGlassPane
to use for progress updates of this task
-
executeTask
protected abstract void executeTask()This method is called when the task is executed. -
finishTask
protected abstract void finishTask()This method is called when the task has finished. -
doInBackground
protected final java.lang.Void doInBackground() throws java.lang.Exception- Specified by:
doInBackground
in classjavax.swing.SwingWorker<java.lang.Void,java.lang.Integer>
- Returns:
- -
- Throws:
java.lang.Exception
- -
-
process
protected final void process(java.util.List<java.lang.Integer> chunks)- Overrides:
process
in classjavax.swing.SwingWorker<java.lang.Void,java.lang.Integer>
-
done
protected final void done()- Overrides:
done
in classjavax.swing.SwingWorker<java.lang.Void,java.lang.Integer>
-