public class AWTEDTExecutor extends Object implements RunnableExecutor
RunnableExecutor.CurrentThreadExecutor
Modifier and Type | Field and Description |
---|---|
static AWTEDTExecutor |
singleton
RunnableExecutor implementation invoking Runnable.run()
on the AWT EDT. |
currentThreadExecutor
Modifier and Type | Method and Description |
---|---|
void |
invoke(boolean wait,
Runnable r) |
boolean |
invoke(Object treeLock,
boolean allowOnNonEDT,
boolean wait,
Runnable r)
Executes the given runnable on the AWT-EDT and return
true , if
current-thread is the AWT-EDT, or
the given tree-lock is not hold by current-thread (-> invoke on AWT-EDT)
|
public static final AWTEDTExecutor singleton
RunnableExecutor
implementation invoking Runnable.run()
on the AWT EDT.public void invoke(boolean wait, Runnable r)
invoke
in interface RunnableExecutor
wait
- if true method waits until Runnable.run()
is completed, otherwise don't wait.r
- the Runnable
to be executed.public boolean invoke(Object treeLock, boolean allowOnNonEDT, boolean wait, Runnable r)
true
, if
Otherwise execute the given runnable on the current-thread and return true
, if
allowOnNonEDT
is true
.
This implies that the given tree-lock is being hold by the current-thread.
Otherwise the runnable is not executed and false
is returned.
treeLock
- representing the AWT-tree-lock, i.e. Component.getTreeLock()
allowOnNonEDT
- allow execution on non AWT-EDT in case current thread is not AWT-EDT and the tree-lock is being holdwait
- if true method waits until Runnable.run()
is completed, otherwise don't wait.r
- the Runnable
to be executed.true
if the Runnable
has been issued for execution, otherwise false