martin-fleck / momot

Marrying Search-based Optimization and Model Transformation Technology
http://martin-fleck.github.io/momot/
17 stars 6 forks source link

SearchExecutor does not pass ExecutorService correctly #5

Closed sjiherzig closed 7 years ago

sjiherzig commented 7 years ago

It looks like SearchExecutor passes a null reference instead of a newly created ExecutorService object:

...
           } else if(getNumberOfThreads() > 1) {
               executorService = Executors.newFixedThreadPool(getNumberOfThreads());
               problem = new DistributedProblem(problem, getExecutorService());
            }
...

It should instead read:

problem = new DistributedProblem(problem, executorService);

In the context, executorService refers to a local variable. It does not refer to the (private) field executorService from the superclass whose value can be accessed using getExecutorService(). Hence, calling getExecutorService() does not return the newly created executorService, but instead null.

martin-fleck commented 7 years ago

Hi Sebastian, You are absolutely right! Thank you very much for the fix, I merged it!