Java - 并发ExecutionException

时间:2017-07-14 11:14:29

标签: java

当我调用以下函数时,出现Internal error: anatlyzer.atl.analyser.AnalyserInternalError: java.util.concurrent.ExecutionException: java.lang.NullPointerException错误。尝试,捕获,最后全部运行。我该如何解决?

public void perform() {
    ExecutorService executor = Executors.newSingleThreadExecutor();
    Future<?> result = executor.submit(new Runnable() {         
        @Override
        public void run() {
            AnalyserContext.setErrorModel(errors);
            AnalyserContext.setTypingModel(typ);                
            AnalyserContext.setGlobalNamespace(mm);
            stage++;
            List<? extends Unit> units = trafo.allObjectsOf(Unit.class);
            for (Unit unit : units) {
                new ExtendTransformation(trafo, mm, unit).perform();
 ...        } });

    try {
        // wait;
        result.get();
    } catch (Exception e) {
        throw new AnalyserInternalError(e, stage);
    } finally {         
        executor.shutdown();
    }
}

0 个答案:

没有答案