void handleResult()

in tablestore/src/main/java/com/alicloud/openservices/tablestore/core/AsyncBatchGetRowCompletion.java [81:143]


    void handleResult(BatchGetRowResponse result) {
        // Process the first Result
        if (tableToResults == null) {
            tableToResults = new ConcurrentHashMap<String, PartialRowResult[]>();
            for (Map.Entry<String, List<BatchGetRowResponse.RowResult>> entry : result.getTableToRowsResult().entrySet()) {
                PartialRowResult[] partialRowResults = new PartialRowResult[entry.getValue().size()];
                tableToResults.put(entry.getKey(), partialRowResults);
                int idx = 0;
                for (BatchGetRowResponse.RowResult rowResult : entry.getValue()) {
                    partialRowResults[idx] = new PartialRowResult();
                    if (rowResult.isSucceed()) {
                        partialRowResults[idx].consumedCapacity = rowResult.getConsumedCapacity();
                        if (rowResult.hasNextToken()) {
                            partialRowResults[idx].nextToken = rowResult.getNextToken();
                        }
                        if (rowResult.getRow() != null) {
                            partialRowResults[idx].primaryKey = rowResult.getRow().getPrimaryKey();
                            partialRowResults[idx].columns = new ArrayList<Column>(Arrays.asList(rowResult.getRow().getColumns()));
                        }
                    } else {
                        partialRowResults[idx].error = rowResult.getError();
                    }
                    idx++;
                }
            }
        } else {
            for (Map.Entry<String, List<BatchGetRowResponse.RowResult>> entry : result.getTableToRowsResult().entrySet()) {
                PartialRowResult[] partialRowResults = tableToResults.get(entry.getKey());
                int idx = 0;
                for (BatchGetRowResponse.RowResult rowResult : entry.getValue()) {
                    while (partialRowResults[idx].isComplete()) {
                        idx++;
                    }
                    if (rowResult.isSucceed()) {
                        handleConsumedCapacity(partialRowResults[idx].consumedCapacity, rowResult.getConsumedCapacity());
                        if (rowResult.hasNextToken()) {
                            partialRowResults[idx].nextToken = rowResult.getNextToken();
                        } else {
                            partialRowResults[idx].nextToken = null;
                        }
                        if (rowResult.getRow() != null) {
                            try {
                                if (partialRowResults[idx].primaryKey == null) {
                                    partialRowResults[idx].primaryKey = rowResult.getRow().getPrimaryKey();
                                    partialRowResults[idx].columns = new ArrayList<Column>();
                                }
                                partialRowResults[idx].columns.addAll(Arrays.asList(rowResult.getRow().getColumns()));
                            } catch (Exception ex) {
                                ex.printStackTrace();
                            }
                        }
                    } else {
                        partialRowResults[idx].error = rowResult.getError();
                    }
                    idx++;
                }
            }
        }
        if (requestIds == null) {
            requestIds = new ArrayList<String>();
        }
        requestIds.add(result.getRequestId());
    }