canUpdate = new HashSet<>();
}
+ private static boolean listContains(List<AlignCalcWorkerI> upd,
+ AlignCalcWorkerI worker)
+ {
+ // avoid use of 'Contains' in case
+ for (AlignCalcWorkerI _otherworker : upd)
+ {
+ if (_otherworker == upd)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
@Override
public void notifyStart(AlignCalcWorkerI worker)
{
}
synchronized (upd)
{
- // avoid use of 'Contains' in case
- for (AlignCalcWorkerI _otherworker : upd)
+ if (listContains(upd, worker))
{
- if (_otherworker == upd)
- {
- Cache.log.debug(
+ Cache.log.debug(
"Ignoring second call to notifyStart for worker "
+ worker);
- return;
- }
}
+ else
+ {
upd.add(worker);
+ }
}
}
}
{
synchronized (inProgress)
{
- if (inProgress.contains(worker))
+ if (listContains(inProgress, worker))
{
return false; // worker is already working, so ask caller to wait around
}
{
synchronized (inProgress)
{
- // System.err.println("Worker " + worker + " marked as complete.");
+ Cache.log.debug("Worker " + worker + " marked as complete.");
inProgress.remove(worker);
List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
if (upd != null)
{
synchronized (restartable)
{
- if (!restartable.contains(worker))
+ if (!listContains(restartable, worker))
{
restartable.add(worker);
}