public boolean isRunning() { boolean hasActiveTasks = false; for (Task<?> task: tasks) { if (task.isBegun() && !task.isDone()) { hasActiveTasks = true; break; } } if (!started && hasActiveTasks) { log.warn("Poller should not be running, but has active tasks, tasks: "+tasks); } return started && hasActiveTasks; }
if (!Objects.equal(o1.isBegun() && !o1.isDone(), o2.isBegun() && !o2.isDone())) weight += 60 * (o1.isBegun() && !o1.isDone() ? -1 : 1); if (!Objects.equal(o1.isBegun(), o2.isBegun())) weight += 10 * (!o1.isBegun() ? -1 : 1); long t1 = o1.isDone() ? o1.getEndTimeUtc() : o1.isBegun() ? o1.getStartTimeUtc() : o1.getSubmitTimeUtc(); long t2 = o2.isDone() ? o2.getEndTimeUtc() : o2.isBegun() ? o2.getStartTimeUtc() : o2.getSubmitTimeUtc(); long u1 = now - t1; long u2 = now - t2;