Skip to content

Bug in EngineConcurrency.java #155

@wiemp

Description

@wiemp

Dear Jeff,
I found the following issue, which seems to be a bug in EngineConcurrency.java:

In the shutdown() method, called from Encog.shutdown(), the static executor variable is set to "null". When this method is called and later during a program run, a call to setThreadCount is done (in version 3.1.0, this could be from BasicGeneticAlgorithm.java => iteration() ), the executor variable is still "null", because the initialization is never executed again and the call to executor.shutdown will fail with a null pointer exception.
I therefore suggest, to add a fix to this class:

public void setThreadCount(int t) {
if (this.executor != null)
this.executor.shutdown();
int threads = t;

best Regards,
Winfried

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions