Concurrency Netbeans JME – General Question

Hello,

I have got an interessant problem which not directly causes an error. However, help would be appreciated.

I now understand the concurrency topic. I have got a Netbeans platform application running on a thread A. Moreover, I have got JME3 running on thread B. all calls are performed via enque method.

I built a node wrapper around the JME3 library. Let’s say I have got a GeometryNode representing a Geometry object, a MeshNode representing a Mesh object etc.

If I add the MeshNode to a GeometryNode, the mesh object is attached to the GeometryNode of course. Now, imagine, that the mesh object has to be build in a loading process. This takes time. I write something like…

[java]

Future<Mesh> mesh=PraxitelesApplication.findInstance().getApplication().enqueue(new Callable<Mesh>() {

@Override

public Mesh call() throws Exception {

///mesh init

return myMeshObject;

}

});

[/java]

OK. But a Callable is returned, no Future where I can override the isDone() method. This means to me that if I want to add my mesh to the geometry object, which happens of course asynchronously, because it takes time to calculate the mesh, I have to save the Future object, and call its isDone() method continuously in a ThreadLoop to, if finished, get the mesh via the get() method and add it to the geometry. Where do I have to continuously call the isDone() method?

I think I missed something. Wouldn’t it be better to have a Future object within the enqueue method to override the methods there?

Thanks.

Regards,

Equi

Why not let your call() tell another Callable enqued in the Nebeans thread that it is done working.?

The netbeansthread callable then can do the work still left.