FIXME: Update this documentation! This class just provides a main-thread utility, forking of a main java class on another thread while being able to continue doing platform specific things on the main-thread. The latter is essential for eg. MacOSX, where we continue to run NSApp.run().
This class provides a startup singleton main thread, from which a new thread with the users main class is launched.invoke(..) ,
have a look at the NEWT Mac OSX Window driver implementationTodo
Some hardcoded dependencies exist in this implementation, where you have to patch this code or factor it out.
If your platform is not Mac OS X, but you want to test your code without modifying
this class, you have to set the system property newt.MainThread.force to true.
The code is compatible with all other platform, which support multithreaded windowing handling.
Since those platforms won't trigger the main thread serialization, the main method
will be simply executed, in case you haven't set newt.MainThread.force to true.
Test case on Mac OS X (or any other platform):
java -XstartOnFirstThread com.jogamp.newt.util.MainThread demos.es1.RedSquare -GL2 -GL2 -GL2 -GL2Which starts 4 threads, each with a window and OpenGL rendering.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| protected static final boolean | |
| public static final boolean | HINT_USE_MAIN_THREAD
if true, use the main thread EDT, otherwise AWT's EDT |
| private static final boolean | |
| private static final String | |
| private static MainThread. | |
| private static final Platform. | |
| private static final ThreadGroup | |
| private static final MainThread | |
| public static boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static final Thread[] | |
| private static final int | |
| private static final List | |
| private static final ThreadGroup | |
| public static MainThread | |
| public static void |
| DEBUG | back to summary |
|---|---|
| protected static final boolean DEBUG | |
| HINT_USE_MAIN_THREAD | back to summary |
|---|---|
| public static final boolean HINT_USE_MAIN_THREAD if true, use the main thread EDT, otherwise AWT's EDT | |
| isMacOSX | back to summary |
|---|---|
| private static final boolean isMacOSX | |
| MACOSXDisplayClassName | back to summary |
|---|---|
| private static final String MACOSXDisplayClassName | |
| mainAction | back to summary |
|---|---|
| private static MainThread. | |
| osType | back to summary |
|---|---|
| private static final Platform. | |
| rootThreadGroup | back to summary |
|---|---|
| private static final ThreadGroup rootThreadGroup | |
| singletonMainThread | back to summary |
|---|---|
| private static final MainThread singletonMainThread | |
| useMainThread | back to summary |
|---|---|
| public static boolean useMainThread | |
| MainThread | back to summary |
|---|---|
| public MainThread() | |
| getAllThreads | back to summary |
|---|---|
| private static final Thread[] getAllThreads(final int[] count) | |
| getNonDaemonThreadCount | back to summary |
|---|---|
| private static final int getNonDaemonThreadCount(final List<Thread> ignoreThreads) | |
| getNonDaemonThreads | back to summary |
|---|---|
| private static final List | |
| getRootThreadGroup | back to summary |
|---|---|
| private static final ThreadGroup getRootThreadGroup() | |
| getSingleton | back to summary |
|---|---|
| public static MainThread getSingleton() | |
| main | back to summary |
|---|---|
| public static void main(final String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException Your new java application main entry, which pipelines your application | |
| Modifier and Type | Field and Description |
|---|---|
| private final String[] | |
| private final Method | |
| private final String | |
| private final String | |
| private List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | run()
Overrides java. Implements java. |
| mainClassArgs | back to summary |
|---|---|
| private final String[] mainClassArgs | |
| mainClassMain | back to summary |
|---|---|
| private final Method mainClassMain | |
| mainClassName | back to summary |
|---|---|
| private final String mainClassName | |
| mainClassNameShort | back to summary |
|---|---|
| private final String mainClassNameShort | |
| nonDaemonThreadsAtStart | back to summary |
|---|---|
| private List<Thread> nonDaemonThreadsAtStart | |
| UserApp | back to summary |
|---|---|
| public UserApp(final String mainClassName, final String[] mainClassArgs) throws SecurityException, NoSuchMethodException, ClassNotFoundException | |
| run | back to summary |
|---|---|
| public void run() Overrides java. Implements java. Doc from java. This method is run by the thread when it executes. Subclasses of This method is not intended to be invoked directly. If this thread is a
platform thread created with a
| |