public abstract class SwingExamineTask
extends java.lang.Object
implements java.lang.Runnable
SwingExamineTask task = new SwingExamineTask() {
protected boolean doIt() {
// do something that requires database examine and GUI modification
}
}
// try to run the task immediately, if not possible, run at a later time
if (!task.runImmediately()) {
Job.invokeExamineLater(task, null);
}
Note: it is not necessary to acquire an examine lock in doIt(), as the SwingExamineTask ensures that an examine lock already held in all cases.
Constructor and Description |
---|
SwingExamineTask() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
doIt(boolean immediate)
This should contain the code that needs to examine the database
while in the GUI thread
|
void |
run()
This should only be called by the Job class.
|
boolean |
runImmediately()
This tries to execute doIt() immediately by trying to
acquire an examine lock for the database.
|
public final void run()
run
in interface java.lang.Runnable
public final boolean runImmediately()
protected abstract boolean doIt(boolean immediate)
immediate
- true if run immediately using runImmediate(),
false if run through callback to run().