what is the right approach to create multiple Java3d objects in the same application but in different Canvas3d?
I have a situation with
- many tabs (10-20) in a JTabbedPane
- in each pane I have an own Java3D diagram
- all panes with diagrams are being created in parallel
- each pane creates its own SimpleUniverse, GraficConfiguration, BranchGroup, Canvas, it compiles etc.
- to be responsive, the pane creation is done in a separate worker thread, when this is done, the component with canvas is added to a tab (in EDT)
- during creation I cklicked on some tabs, here and there
Sometimes it worked well, but sometimes the GUI freezes and can only be closed by task killing;
When I create all components in EDT and not in many worker threads, the application stays not responsive during the creation time, I wait 15-30 seconds, then it works well without freezing of GUI;
I watched in JConsole: AWT (also EDT) was BLOCKED, and some other worker threads too; I suppose this happens, when a worker thread creates a Canvas and is getting the PreferredConfiguration() -> also getting something from EDT;
I also have multiple tabs in my application but instead of creating multiple Canvas3D, I created a single Canvas3D. When the user changes table, I simply use a Java3D SwitchGroup to switch to different graphs. It's faster and consumes less memory this way.