Future.get problem

Problems with Future.get on lastest revision (3962). The method doesnt returns.



      Future<Object> future = GameTaskQueueManager.getManager().update(new Callable<Object>() {
         public Object call() throws Exception {
            if(!withShadow)
               gameManager.getV8GameState().getRootNode().getChild("Pista").lock();
            return null;
         }
        });
      try {
         
         future.get();
      } catch (InterruptedException e) {
         
      } catch (ExecutionException e) {
         
      }

are you sure your are not calling this from the jme(gl) thread, so that it never reaches the manager.update?

Im calling that on my Main class Constructor.

Let me explain:

I have my main class constructor and i create StandardGame on it, instantiate my custom gamestates and put the on the GameStateManager.

Set them as active and then call the code from the first post.

This code works well until the lastest revision.

This is not Gl thread isnt it?!

clovis said:

Im calling that on my Main class Constructor.
Let me explain:
I have my main class constructor and i create StandardGame on it, instantiate my custom gamestates and put the on the GameStateManager.
Set them as active and then call the code from the first post.
This code works well until the lastest revision.
This is not Gl thread isnt it?!



Your call to future.get() blocks the current thread until your submitted task is complete. Problem is, you're blocking the thread that processes the game task queue (GL thread) so your submitted task will never be executed. If you're already in the GL thread, there's no reason for your task submit/future.get code and you can safely remove it.

Thats right. Ive already done that.

Im curious that my code worked well until a recent revision.



But the way, its not a problem anymore.



Thanks for help!

clovis said:

Thats right. Ive already done that.
Im curious that my code worked well until a recent revision.

But the way, its not a problem anymore.

Thanks for help!


It may have been the patches I submitted to fix some issues with threading. My guess is your main code was accidentally running outside of the opengl thread.

it is really a problem with the latest version of GameTask.

Same problem with a small test case:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8722.msg67835#msg67835

Updated, please retest.

yay, works again :slight_smile: