Skip to content

代码bug #22

@QAQ516284797

Description

@QAQ516284797
@Override
public List<Point> recordHandlePoints(List<ImportDataStep> steps) {

    System.out.println("多线程查询======== start");

    List<Point> points = new ArrayList<>();
    for (ImportDataStep step : steps) {
        Future<List<Point>> future = executorService.submit(new HighImportDataPointFuture(step, pointLogic));
        try {
            points.addAll(future.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }

    System.out.println("多线程查询======== point " + points.size() + " 条数==============");
    return points;
}

位于 HighImportDataServiceImpl 实现错误了吧,future.get()会阻塞线程 所以实际上是串行提交,没有线程并行
future.get()应该在任务提交之外的循环遍历获取吧

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions