
org.jobrunr.dashboard.ui.model.problems.ProblemsManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jobrunr Show documentation
Show all versions of jobrunr Show documentation
An easy way to perform background processing on the JVM. Backed by persistent storage. Open and free for commercial use.
package org.jobrunr.dashboard.ui.model.problems;
import org.jobrunr.storage.StorageProvider;
import java.util.HashMap;
import java.util.Map;
public class ProblemsManager {
private final StorageProvider storageProvider;
private final Problems problems;
private final Map problemHandlers;
public ProblemsManager(StorageProvider storageProvider) {
this.storageProvider = storageProvider;
this.problems = new Problems();
this.problemHandlers = initProblemHandlers();
}
private Map initProblemHandlers() {
Map result = new HashMap<>();
result.put(ScheduledJobsNotFoundProblem.PROBLEM_TYPE, new ScheduledJobsNotFoundProblemHandler(problems, storageProvider));
result.put(SevereJobRunrExceptionProblem.PROBLEM_TYPE, new SevereJobRunrExceptionProblemHandler(problems, storageProvider));
result.put(CpuAllocationIrregularityProblem.PROBLEM_TYPE, new CpuAllocationIrregularityProblemHandler(problems, storageProvider));
result.put(PollIntervalInSecondsTimeBoxIsTooSmallProblem.PROBLEM_TYPE, new PollIntervalInSecondsTimeBoxIsTooSmallProblemHandler(problems, storageProvider));
return result;
}
public Problems getProblems() {
return problems;
}
public void dismissProblemOfType(String param) {
if (problemHandlers.containsKey(param)) {
problemHandlers.get(param).dismiss();
} else {
throw new IllegalArgumentException("Unknown problem of type '" + param + "'");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy