Top Description Fields Methods
com.jogamp.newt.util

public Interface EDTUtil

Known Direct Implementers
jogamp.newt.DefaultEDTUtil, jogamp.newt.driver.awt.AWTEDTUtil, jogamp.newt.swt.SWTEDTUtil
Imports
jogamp.newt.DisplayImpl, com.jogamp.newt.event.NEWTEvent

EDT stands for Event Dispatch Thread.

EDTUtil comprises the functionality of:

The EDT pattern is a common tool to comply with todays windowing toolkits, where the common denominator in regards to multithreading is to: Note: This is not true on MacOSX, where all these actions have to be performed by a unique, so called main thread.

Field Summary

Modifier and TypeField and Description
public static final long

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

poll period in milliseconds
getPollPeriod
()

public boolean

Returns:

true if task has been executed or queued for later execution, otherwise false
invoke
(boolean wait, Runnable task)

Appends task to the EDT task queue if current thread is not EDT, otherwise execute task immediately.

public boolean

Returns:

true if task has been executed or queued for later execution, otherwise false
invokeStop
(boolean wait, Runnable finalTask)

Append the final task to the EDT task queue, signals EDT to stop.

public boolean
isCurrentThreadEDT()

Returns true if the current thread is the event dispatch thread (EDT).

public boolean
isCurrentThreadEDTorNEDT()

Returns true if either isCurrentThreadEDT() or isCurrentThreadNEDT() is true, otherwise false.

public boolean
isCurrentThreadNEDT()

Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).

public boolean

Returns:

True if EDT is running and not subject to be stopped.
isRunning
()

public void
setPollPeriod(long
poll period in milliseconds
ms
)

public void
start()

Starts the EDT after it's creation or after stopping.

public boolean

Returns:

true if waited for idle, otherwise false, i.e. in case of current thread is EDT or NEDT
waitUntilIdle
()

Wait until the EDT task queue is empty.

public boolean

Returns:

true if stopped, otherwise false, i.e. in case of current thread is EDT or NEDT
waitUntilStopped
()

Wait until EDT task is stopped.

Field Detail

defaultEDTPollPeriodback to summary
public static final long defaultEDTPollPeriod

Method Detail

getPollPeriodback to summary
public long getPollPeriod()
Returns:long

poll period in milliseconds

invokeback to summary
public boolean invoke(boolean wait, Runnable task)

Appends task to the EDT task queue if current thread is not EDT, otherwise execute task immediately.

Wait until execution is finished if wait == true.

Can be issued from within EDT, ie from within an enqueued task.
Returns:boolean

true if task has been executed or queued for later execution, otherwise false

invokeStopback to summary
public boolean invokeStop(boolean wait, Runnable finalTask)

Append the final task to the EDT task queue, signals EDT to stop.

If wait is true methods blocks until EDT is stopped.

task maybe null
Due to the nature of this method:

  • All previous queued tasks will be finished.
  • No new tasks are allowed, an Exception is thrown.
  • Can be issued from within EDT, ie from within an enqueued task.
  • start() may follow immediately, ie creating a new EDT

Returns:boolean

true if task has been executed or queued for later execution, otherwise false

isCurrentThreadEDTback to summary
public boolean isCurrentThreadEDT()

Returns true if the current thread is the event dispatch thread (EDT).

The EDT is the platform specific thread dispatching toolkit-events and executing toolkit-tasks enqueued via invoke(boolean, Runnable).

Usually it is the same thread as used to dequeue informal NEWTEvents (NEDT), see isCurrentThreadNEDT(), however, this may differ, e.g. SWT and AWT implementation.

isCurrentThreadEDTorNEDTback to summary
public boolean isCurrentThreadEDTorNEDT()

Returns true if either isCurrentThreadEDT() or isCurrentThreadNEDT() is true, otherwise false.

isCurrentThreadNEDTback to summary
public boolean isCurrentThreadNEDT()

Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).

The NEDT is the NEWT thread used to dequeue informal NEWTEvents enqueued internally via DisplayImpl#enqueueEvent(boolean, NEWTEvent).

Usually it is the same thread as the EDT, see isCurrentThreadEDT(), however, this may differ, e.g. SWT and AWT implementation.

isRunningback to summary
public boolean isRunning()
Returns:boolean

True if EDT is running and not subject to be stopped.

setPollPeriodback to summary
public void setPollPeriod(long ms)
Parameters
ms:long

poll period in milliseconds

startback to summary
public void start() throws IllegalStateException

Starts the EDT after it's creation or after stopping.

If the EDT is running, it must be stopped first and the caller should wait until it's stopped.

Exceptions
IllegalStateException:
if EDT is running and not subject to be stopped, i.e. isRunning() returns true
RuntimeException:
if EDT could not be started
See Also
invokeStop(boolean, java.lang.Runnable), waitUntilStopped()
waitUntilIdleback to summary
public boolean waitUntilIdle()

Wait until the EDT task queue is empty.
The last task may still be in execution when this method returns.

Returns:boolean

true if waited for idle, otherwise false, i.e. in case of current thread is EDT or NEDT

waitUntilStoppedback to summary
public boolean waitUntilStopped()

Wait until EDT task is stopped.
No stop action is performed, invokeStop(boolean, java.lang.Runnable) should be used before.

If caller thread is EDT or NEDT, this call will not block.

Returns:boolean

true if stopped, otherwise false, i.e. in case of current thread is EDT or NEDT