-
Bug
-
Resolution: Done
-
Major
-
5.1.5.FINAL
-
None
We currently use some custom commands with Infinispan. We have since moved over to wanting to use a custom command with a return value for the response.
We have tried using the various methods on the RpcManager and have found a few issues.
1. Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, boolean sync, boolean usePriorityQueue) throws RpcException;
This method always returns a null for cluster responses. This is a simple issue that can be solved with the following diff
diff --git a/core/src/main/java/org/infinispan/commands/remote/SingleRpcCommand. index bf369bc..79bc02e 100644 --- a/core/src/main/java/org/infinispan/commands/remote/SingleRpcCommand.java +++ b/core/src/main/java/org/infinispan/commands/remote/SingleRpcCommand.java @@ -107,6 +107,6 @@ public ReplicableCommand getCommand() { @Override public boolean isReturnValueExpected() { - return false; + return command.isReturnValueExpected(); } }
The SingleRpcCommand wraps the given command always forcing the return value expectation to be false.
2. Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout);
This method doesn't wrap the return value in a Response thus causing a ClassCastException when the client node gets the response back. I haven't looked into detail with this one yet.
If needed I can send a sample project that shows the behavior.