From 3582d6d054f74fee68dcc74553cf504f10e0165c Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 1 Nov 2016 20:27:02 +1300 Subject: All Java3D threads set to daemon Bug 1111 - Java3D does not dispose correctly after use Note there is a strong possibility that this could have side effects particularly in headless environments. However a daemon nature is more correct and will allow applications to exit gracefully and when expected. In testing normal swing operations can cause non-exiting. E.g. JFrame f = new JFrame(); f.pack(); will not exit unless f.dispose(); is called. This is unrelated to Java3D. --- src/main/java/org/jogamp/java3d/MasterControl.java | 3 +++ src/main/java/org/jogamp/java3d/MasterControlThread.java | 1 + 2 files changed, 4 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/org/jogamp/java3d/MasterControl.java b/src/main/java/org/jogamp/java3d/MasterControl.java index d5a9684..b60710c 100644 --- a/src/main/java/org/jogamp/java3d/MasterControl.java +++ b/src/main/java/org/jogamp/java3d/MasterControl.java @@ -1686,6 +1686,7 @@ private static String getProperty(final String prop) { synchronized (rootThreadGroup) { s.updateThread = new StructureUpdateThread( rootThreadGroup, s, s.threadType); + s.updateThread.setDaemon(true); s.updateThread.setPriority(threadPriority); } return null; @@ -2010,6 +2011,7 @@ private static String getProperty(final String prop) { public Object run() { synchronized (rootThreadGroup) { timerThread = new TimerThread(rootThreadGroup); + timerThread.setDaemon(true); timerThread.setPriority(threadPriority); } return null; @@ -2024,6 +2026,7 @@ private static String getProperty(final String prop) { public Object run() { synchronized (rootThreadGroup) { notificationThread = new NotificationThread(rootThreadGroup); + notificationThread.setDaemon(true); notificationThread.setPriority(threadPriority); } return null; diff --git a/src/main/java/org/jogamp/java3d/MasterControlThread.java b/src/main/java/org/jogamp/java3d/MasterControlThread.java index a27ce7f..914e506 100644 --- a/src/main/java/org/jogamp/java3d/MasterControlThread.java +++ b/src/main/java/org/jogamp/java3d/MasterControlThread.java @@ -50,6 +50,7 @@ class MasterControlThread extends Thread { MasterControlThread(ThreadGroup threadGroup) { super(threadGroup, ""); + setDaemon(true); setName("J3D-MasterControl-" + getInstanceNum()); VirtualUniverse.mc.createMCThreads(); this.start(); -- cgit v1.2.3