Top Description Fields Constructors Methods
com.jogamp.common.util.awt

public Class AWTEDTExecutor

extends Object
implements RunnableExecutor
Class Inheritance
All Implemented Interfaces
com.jogamp.common.util.RunnableExecutor
Imports
java.awt.EventQueue, java.lang.reflect.InvocationTargetException, com.jogamp.common.util.RunnableExecutor

AWT EDT implementation of RunnableExecutor

Field Summary

Modifier and TypeField and Description
public static final AWTEDTExecutor
singleton

RunnableExecutor implementation invoking Runnable#run() on the AWT EDT.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
invoke(final boolean
if true method waits until Runnable#run() is completed, otherwise don't wait.
wait
,
final Runnable
the Runnable to be executed.
r
)

Implements com.jogamp.common.util.RunnableExecutor.invoke.

public boolean

Returns:

true if the Runnable has been issued for execution, otherwise false
invoke
(final Object
representing the AWT-tree-lock, i.e. java.awt.Component#getTreeLock()
treeLock
,
final boolean
allow execution on non AWT-EDT in case current thread is not AWT-EDT and the tree-lock is being hold
allowOnNonEDT
,
final boolean
if true method waits until Runnable#run() is completed, otherwise don't wait.
wait
,
final Runnable
the Runnable to be executed.
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)
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

singletonback to summary
public static final AWTEDTExecutor singleton

RunnableExecutor implementation invoking Runnable#run() on the AWT EDT.

Constructor Detail

AWTEDTExecutorback to summary
private AWTEDTExecutor()

Method Detail

invokeback to summary
public void invoke(final boolean wait, final Runnable r)

Implements com.jogamp.common.util.RunnableExecutor.invoke.

Parameters
wait:boolean

Doc from com.jogamp.common.util.RunnableExecutor.invoke.

if true method waits until Runnable#run() is completed, otherwise don't wait.

r:Runnable

Doc from com.jogamp.common.util.RunnableExecutor.invoke.

the Runnable to be executed.

Annotations
@Override
invokeback to summary
public boolean invoke(final Object treeLock, final boolean allowOnNonEDT, final boolean wait, final 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)

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.

Parameters
treeLock:Object

representing the AWT-tree-lock, i.e. java.awt.Component#getTreeLock()

allowOnNonEDT:boolean

allow execution on non AWT-EDT in case current thread is not AWT-EDT and the tree-lock is being hold

wait:boolean

if true method waits until Runnable#run() is completed, otherwise don't wait.

r:Runnable

the Runnable to be executed.

Returns:boolean

true if the Runnable has been issued for execution, otherwise false