protected Object call() { InternalPartitionService service = getService(InternalPartitionService.SERVICE_NAME); service.firstArrangement(); Map<Address, List<Integer>> partitionsMap = new HashMap<Address, List<Integer>>(); for (InternalPartition partition : service.getPartitions()) { Address owner = partition.getOwnerOrNull(); if (owner == null) { partitionsMap.clear(); return ClientGetPartitionsCodec.encodeResponse(partitionsMap.entrySet()); } List<Integer> indexes = partitionsMap.get(owner); if (indexes == null) { indexes = new LinkedList<Integer>(); partitionsMap.put(owner, indexes); } indexes.add(partition.getPartitionId()); } return ClientGetPartitionsCodec.encodeResponse(partitionsMap.entrySet()); }
@Override protected ClientGetPartitionsCodec.RequestParameters decodeClientMessage( ClientMessage clientMessage) { return ClientGetPartitionsCodec.decodeRequest(clientMessage); }