JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.nativewindow.awt.AppContextInfo Class Reference

Instance of this class holds information about a ThreadGroup associated sun.awt.AppContext. More...

Collaboration diagram for com.jogamp.nativewindow.awt.AppContextInfo:

Public Member Functions

 AppContextInfo (final String info)
 
final boolean isValid ()
 Returns true if this instance has valid sun.awt.AppContext information, i.e. More...
 
final ThreadGroup getCachedThreadGroup ()
 Returns the ThreadGroup belonging to the last known sun.awt.AppContext as queried via update(String). More...
 
RunnableTask invokeOnAppContextThread (final boolean waitUntilDone, final Runnable runnable, final String threadBaseName)
 Invokes runnable on a Thread belonging to the sun.awt.AppContext ThreadGroup, see getCachedThreadGroup(). More...
 
final boolean update (final String info)
 Update sun.awt.AppContext information for the current ThreadGroup if uninitialized or sun.awt.AppContext changed. More...
 

Detailed Description

Instance of this class holds information about a ThreadGroup associated sun.awt.AppContext.

Non intrusive workaround for Bug 983 and Bug 1004, see getCachedThreadGroup().

Definition at line 20 of file AppContextInfo.java.

Constructor & Destructor Documentation

◆ AppContextInfo()

com.jogamp.nativewindow.awt.AppContextInfo.AppContextInfo ( final String  info)

Definition at line 49 of file AppContextInfo.java.

Here is the call graph for this function:

Member Function Documentation

◆ getCachedThreadGroup()

final ThreadGroup com.jogamp.nativewindow.awt.AppContextInfo.getCachedThreadGroup ( )

Returns the ThreadGroup belonging to the last known sun.awt.AppContext as queried via update(String).

Returns null if no sun.awt.AppContext has been queried.

The returned ThreadGroup allows users to create a custom thread belonging to it and hence mitigating Bug 983 and Bug 1004.

update(String) should be called from a thread belonging to the desired sun.awt.AppContext, i.e. early from within the special threaded application.

E.g. JAWTWindow issues update(String) in it's constructor.

Definition at line 79 of file AppContextInfo.java.

Here is the caller graph for this function:

◆ invokeOnAppContextThread()

RunnableTask com.jogamp.nativewindow.awt.AppContextInfo.invokeOnAppContextThread ( final boolean  waitUntilDone,
final Runnable  runnable,
final String  threadBaseName 
)

Invokes runnable on a Thread belonging to the sun.awt.AppContext ThreadGroup, see getCachedThreadGroup().

update(String) is issued first, which returns true if the current thread belongs to an AppContext ThreadGroup. In this case the runnable is invoked on the current thread, otherwise a new Thread will be started.

If a new Thread is required, the AppContext ThreadGroup is being used if available, otherwise the default system ThreadGroup.

Parameters
waitUntilDoneif true, waits until runnable execution is completed, otherwise returns immediately.
runnablethe Runnable to be executed. If waitUntilDone is true, the runnable must exist, i.e. not loop forever.
threadBaseNamethe base name for the new thread if required. The resulting thread name will have either '-OnAppContextTG' or '-OnSystemTG' appended
Returns
the Thread used to invoke the runnable, which may be the current Thread or a newly created one, see above.

Definition at line 105 of file AppContextInfo.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValid()

final boolean com.jogamp.nativewindow.awt.AppContextInfo.isValid ( )

Returns true if this instance has valid sun.awt.AppContext information, i.e.

getCachedThreadGroup() returns not null.

Definition at line 57 of file AppContextInfo.java.

Here is the call graph for this function:

◆ update()

final boolean com.jogamp.nativewindow.awt.AppContextInfo.update ( final String  info)

Update sun.awt.AppContext information for the current ThreadGroup if uninitialized or sun.awt.AppContext changed.

See getCachedThreadGroup() for usage.

Parameters
infoinformal string for logging purposes
Returns
true if the current ThreadGroup is mapped to an sun.awt.AppContext and the information is good, otherwise false.

Definition at line 132 of file AppContextInfo.java.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: