14 Replies Latest reply: Apr 17, 2012 4:30 PM by Vladimir Blagojevic RSS

How to get execution result from a remote node when using DistributedExecutorService ?

Dmitry Udalov Newbie

I use DistributedExecutorService.submitEverywhere on a replicated cache with several nodes.

The task implements both DistributedCallable and Serializable. BTW, the latter is not documented by Infinispan! The task is simple; return type is a string. It's similar to https://docs.jboss.org/author/display/ISPN/Infinispan+Distributed+Execution+Framework

 

 

From my tests I see that the task is executed once on each node, which is what I expect. However I can get the results from the local node only. For all remote nodes I'm getting an exception:

 

java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Invalid response {Sound-24395=null}

        at org.infinispan.distexec.DefaultExecutorService$DistributedRunnableFuture.retrieveResult(DefaultExecutorService.java:611)

        at org.infinispan.distexec.DefaultExecutorService$DistributedRunnableFuture.get(DefaultExecutorService.java:558)

       

I see that execution framework first creates DistributedExecuteCommand which is “transferred” to remote nodes as SingleRpcCommand (see RpcManagerImpl.invokeRemotely). However SingleRpcCommand doesn’t expect any return values, which causes DefaultResponseGenerator.getResponse returning null.

 

I’m not sure if I as API user have any control over it. Do I? Can I specify that I want result be available when I create my DistributedCallable?