• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java3D close but not exit

 
Florian Schaetz
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've got a class that is used to create a 3D image, using Java3D, saving it into a file (without putting it into JFrame).

Unfortunately, the application using that class never closes, as somehow the AWT Threads don't finish. The same behavior can be easily reproduced when using the 3D "Hello Universe" example and simply removing "setVisible(true)": Even it not visible, it somehow stops the application from finishing.

Also, if I call the class two times in the program, the 2nd try blocks at...



Somehow it seems that something isn't released properly or something like that. I already tried to call "finish" (using Reflection) on the Render-Thread, as suggest in some posting I found via Google, but that doesn't seem to help. Also, caching that device does not help, as then calls to GraphicsConfiguration, etc. will block. Somehow there is a lock or something I have to release, but I cannot seem to find it.

As my class is intended to be used on the server, calling System.exit() is of course dead wrong...

Would be really glad if someone had an idea for that...

Regards,

Flo
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As my class is intended to be used on the server, calling System.exit() is of course dead wrong.

Why is that? If you don't intend for the JVM to exit, what do you expect to happen that doesn't? I'm assuming that the JVM runs in headless mode already.
 
Florian Schaetz
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exiting my ApplicationServer would probably make some people mad, because unfortunately, the 3D image thingy will not the only thing running there ;-)

Running the application headless would be a bad idea, as that stops Java3D from working (Could not initialize class com.sun.j3d.utils.universe.SimpleUniverse). As the code works on the server, but only once, it's not headless.

As written, the non-exit is just a symptom, as calling the class twice also doesn't work, probably for the same reasons. If the only problem was a non-exit, ok, I could probably live with it. Only being able to call the class once, I cannot live with, unfortunately.

( The problem is also mentioned here, but the solution doesn't work for me. )
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so by "close" you mean terminate all graphics-related threads? And by "non-exit" you mean that that is not happening?

I have no insight into J3D specifically (except that I think it's dead, and would advise to migrate to JOGL or some other API instead), but assuming that this issue can't be resolved - would it be possible to kick off the J3D part of the app in a standalone external JVM? That would allow you to use System.exit if necessary, and also avoid the issue of only being able to run it once. Plus, the main app server could run headless, which I think is preferable.
 
Florian Schaetz
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the problem seems to have two consequences:

a) Without an explicit System.exit() the application does not exit but simply hangs around.

b) Inside the application, I cannot call the Java3D code two times, because then it blocks.

Unfortunately, I don't have the time to migrate the whole app to another framework, my current problem is just to move the code to the server. And I just discussed it with a Coworker and we don't have the time to create a complete stand-alone app, as it required a data connection, etc.etc. which would force us to change the whole build process unfortunately.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!