summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2014-05-03 09:02:52 -0700
committerHarvey Harrison <[email protected]>2014-05-03 09:04:53 -0700
commit1f025a8787edec6e2ae1eab3a3fd0eb59319e3c4 (patch)
tree217ee5c79784cfba4c4482061e6fd3f05af7eadf
parenta5f67b5d4003732cf5fbbea7157220be46999939 (diff)
Revert "j3dutils: add workaround for appcontext bug in Java 7 u25"HEAD1.6.0-pre10master
This reverts commit 14206478b7a5bf628b59094c92d5727291c7c2bf. The fixup has been moved into the core pipeline code. The parts of the above commit removing a println and adjusting the max wait time have been preserved. Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r--src/classes/share/com/sun/j3d/exp/swing/JCanvas3D.java56
1 files changed, 2 insertions, 54 deletions
diff --git a/src/classes/share/com/sun/j3d/exp/swing/JCanvas3D.java b/src/classes/share/com/sun/j3d/exp/swing/JCanvas3D.java
index feee512..e089626 100644
--- a/src/classes/share/com/sun/j3d/exp/swing/JCanvas3D.java
+++ b/src/classes/share/com/sun/j3d/exp/swing/JCanvas3D.java
@@ -56,11 +56,6 @@ import javax.swing.event.AncestorListener;
import com.sun.j3d.exp.swing.impl.AutoOffScreenCanvas3D;
-// EP
-import java.lang.reflect.Field;
-import java.util.Map;
-// EP
-
/**
* This class provides a lightweight capability to Java 3D. The component
@@ -613,7 +608,7 @@ public class JCanvas3D extends JPanel implements AncestorListener {
// to wait for the readback of the off-screen buffer to complete.
// The total time is MAX_WAIT_LOOPS * MAX_WAIT_TIME msec.
private static final int MAX_WAIT_LOOPS = 5;
- private static final long MAX_WAIT_TIME = 10; // EP: Used to be 100;
+ private static final long MAX_WAIT_TIME = 10;
/**
* the bufferedImage that will be displayed as the result
@@ -664,10 +659,6 @@ public class JCanvas3D extends JPanel implements AncestorListener {
*/
boolean waitingForSwap;
- // EP
- Object mainThreadContext;
- // EP
-
/**
* Creates a new instance of JCanvas3D. Resize mode is set
* to RESIZE_IMMEDIATELY and validation delay to 100ms.
@@ -683,15 +674,6 @@ public class JCanvas3D extends JPanel implements AncestorListener {
imageReadyBis = false;
waitingForSwap = false;
addNotifyFlag = false;
-
- // EP
- try {
- // Retrieve main thread AppContext instance by reflection
- this.mainThreadContext = Class.forName("sun.awt.AppContext").getMethod("getAppContext").invoke(null);
- } catch (Throwable ex) {
- // Let's consider app context is not necessary for the program
- }
- // EP
}
/**
@@ -746,11 +728,6 @@ public class JCanvas3D extends JPanel implements AncestorListener {
if (false == waitingForSwap) {
// System.err.println("repaint " + System.currentTimeMillis());
-
- // EP
- checkAppContext();
- // EP
-
this.lwCanvas.repaint();
} else {
notify();
@@ -760,33 +737,6 @@ public class JCanvas3D extends JPanel implements AncestorListener {
}
}
- // EP
- /**
- * Checks that app context is correct.
- */
- private void checkAppContext() {
- if (this.mainThreadContext != null) {
- try {
- // Check by reflection that sun.awt.AppContext.getAppContext() doesn't return null
- // (required by ImageIO.write() and other JMF internal calls) to apply workaround proposed at
- // http://stackoverflow.com/questions/17223304/appcontext-is-null-from-rmi-thread-with-java-7-update-25
- Class<?> appContextClass = Class.forName("sun.awt.AppContext");
- if (appContextClass.getMethod("getAppContext").invoke(null) == null) {
- Field field = appContextClass.getDeclaredField("threadGroup2appContext");
- field.setAccessible(true);
- Map threadGroup2appContext = (Map)field.get(null);
- ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup();
- threadGroup2appContext.put(currentThreadGroup, this.mainThreadContext);
- }
- } catch (Throwable ex) {
- // Let's consider app context is not necessary for the program
- }
- // Don't need mainThreadContext anymore
- this.mainThreadContext = null;
- }
- }
- // EP
-
/**
* Overriden so that the JComponent can access it.
*
@@ -872,9 +822,7 @@ public class JCanvas3D extends JPanel implements AncestorListener {
if (!imageReadyBis && --counter <= 0) {
//if i've waited too long for the canvas to be there, let us declare it crashed.
- // EP
- // System.err.println("CANVAS CRASHED!!!");
- // EP
+ //System.err.println("CANVAS CRASHED!!!");
canvasCrashed = true;
return;
}