MNT-21902 minor fixes to logic added in REPO-5549

This commit is contained in:
alandavis
2021-06-25 18:36:57 +01:00
parent c84a1231a3
commit 0445ba9c93
2 changed files with 7 additions and 4 deletions

View File

@@ -60,14 +60,17 @@ public abstract class ConfigScheduler<Data>
// Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number // Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number
// of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in // of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in
// production but not very likely. // production but not very likely.
public synchronized void execute(JobExecutionContext context) throws JobExecutionException public void execute(JobExecutionContext context) throws JobExecutionException
{ {
JobDataMap dataMap = context.getJobDetail().getJobDataMap(); JobDataMap dataMap = context.getJobDetail().getJobDataMap();
ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER); ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER);
synchronized (configScheduler)
{
boolean successReadingConfig = configScheduler.readConfigAndReplace(true); boolean successReadingConfig = configScheduler.readConfigAndReplace(true);
configScheduler.changeScheduleOnStateChange(successReadingConfig); configScheduler.changeScheduleOnStateChange(successReadingConfig);
} }
} }
}
public static final String CONFIG_SCHEDULER = "configScheduler"; public static final String CONFIG_SCHEDULER = "configScheduler";

View File

@@ -322,7 +322,7 @@ public class CombinedConfig
{ {
combinedTransformers.remove(indexToRemove); combinedTransformers.remove(indexToRemove);
// this may also require the current index i to be changed so we don't skip one. // this may also require the current index i to be changed so we don't skip one.
if (i <= indexToRemove) if (i >= indexToRemove)
{ {
i--; i--;
} }