diff --git a/src/main/java/org/bdware/consistency/plugin/sharding/MultiPointCooperationExecutor.java b/src/main/java/org/bdware/consistency/plugin/sharding/MultiPointCooperationExecutor.java index f91fc69..85a8cec 100644 --- a/src/main/java/org/bdware/consistency/plugin/sharding/MultiPointCooperationExecutor.java +++ b/src/main/java/org/bdware/consistency/plugin/sharding/MultiPointCooperationExecutor.java @@ -128,29 +128,16 @@ public class MultiPointCooperationExecutor extends AbstractContextContractExecut return new String[]{members[val]}; case byFunc: ContractClient client = cmActions.getManager().getClient(req.getContractID()); - - JsonArray membersArr = new JsonArray(members.length); - for (String member : members) { - membersArr.add(member); - } - JsonObject arg = new JsonObject(); arg.addProperty("funcName", routeInfo.funcName); - // func myFunc (currentNode, members, membersCount, sourceArg) + // func myFunc (requester, sourceArg) JsonArray funcArgs = new JsonArray(); - funcArgs.add(globalConf.getNodeID()); - funcArgs.add(membersArr); - funcArgs.add(membersArr.size()); + funcArgs.add(req.getRequester()); funcArgs.add(req.getArg()); arg.add("funcArgs", funcArgs); - String routeResultStr = client.executeMethod("", "invokeFunctionWithoutLimit", arg.toString()); - JsonObject routeResult = JsonUtil.parseString(routeResultStr).getAsJsonObject(); - List nodes = new ArrayList<>(); - for (String key: routeResult.keySet()) { - nodes.add(routeResult.get(key).getAsString()); - } - return nodes.toArray(new String[]{}); + String[] routeResult = JsonUtil.fromJson(routeResultStr, String[].class); + return routeResult; default: return members; }