Concurrency Issue

Hello,

Sometimes, I get an OpenGLException at the start of my Netbeans based program. I know that I should describe the error a little bit better. However, my program is already so complicated that I can hardly provide a testcase. I think I know the reason for it.

I have build a 3D scene program on Netbeans platform like your JMonkey Editor. I use project, nodes etc. Everything. My nodes wrap the JMonkeyEngine classes. When I start my application, the GUI and the Netbeans platform environment has to be initialised. So, I can only start init the JME3 Application when everything is done. The problem seems to be that my node structue, which is part of a project is loaded automatically when the Netbeans platform starts. Whenever a node that wrapps a JME3 class is inited by the Netbeans platform, there are already JME3 methods called. The reason is that the properties are set for the JME3 class. An example for a Geometry wrapper.

[java]

public class MyWrapper{



public Geometry getGeometry(){

if(geometry==null){

geometry=new Geometry("MyGeometry");

}

return geometry;

}



}

[/java]

You can see, that my Wrapper class gets the wrapped JME3 class through a getGeometry method. The same is for Meshes, Materials, Textures etc.

This means, my Netbeans platform starts, sees that a project is opened, expands the nodes, inits the nodes and my program is told to get data from the wrapper class. But if JME3 Application is not yet running there might be a problem.

On the other hand, my JME3 application is only initialised if the canvas is put to a TopComponent Panel, which has to be created fist. etc.etc.

My question is, if it is possible to check if the JME3 application has already FULLY be initialised so that I can tell me wrapper classes to wait until it is done.

I would appreciate help from all people who also use JME3 within Netbeans platform.

Thanks a lot.

Regards,

Equi

What if you enqueue the construction of the object to the application with a callable?

Check if you have accidentally initialized data on the constructor instead of the onInit() method.

e.g Class A

{

Node n = new Node();

public A(){}

}

I don’t know if that will be a problem for jme.