[Fix] Fixed StrolchJobsHandler stop() and destroy()

This commit is contained in:
Robert von Burg 2021-06-07 17:07:37 +02:00
parent 2bec7d89cf
commit ef230cf040
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
package li.strolch.job; package li.strolch.job;
import static java.lang.String.join; import static java.lang.String.join;
import static li.strolch.runtime.StrolchConstants.*; import static li.strolch.runtime.StrolchConstants.TYPE_STROLCH_JOB;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
@ -195,8 +195,10 @@ public class StrolchJobsHandler extends StrolchComponent {
@Override @Override
public void stop() throws Exception { public void stop() throws Exception {
for (StrolchJob job : this.jobs.values()) { if (this.jobs != null) {
job.cancel(true); for (StrolchJob job : this.jobs.values()) {
job.cancel(true);
}
} }
super.stop(); super.stop();
@ -204,7 +206,8 @@ public class StrolchJobsHandler extends StrolchComponent {
@Override @Override
public void destroy() throws Exception { public void destroy() throws Exception {
this.jobs.clear(); if (this.jobs != null)
this.jobs.clear();
super.destroy(); super.destroy();
} }
} }