@Override public int compare(Task<?> t1, Task<?> t2) { long end1 = t1.isDone() ? t1.getEndTimeUtc() : Long.MAX_VALUE; long end2 = t2.isDone() ? t2.getEndTimeUtc() : Long.MAX_VALUE; return (end1 < end2) ? -1 : ((end1 == end2) ? 0 : 1); } });
if (taskContender.isDone() && (System.currentTimeMillis() - taskContender.getEndTimeUtc() > maxTaskAge)) { executionManager.deleteTask(taskContender); } else {
@SuppressWarnings({ "unchecked", "rawtypes" }) public TaskSummary(Task task) { Preconditions.checkNotNull(task); // 'ported' from groovy web console TaskSummary.groovy , not sure if always works as intended Entity entity = (Entity) Iterables.tryFind(task.getTags(), Predicates.instanceOf(Entity.class)).orNull(); if (entity!=null) { this.entityId = entity.getId(); this.entityDisplayName = entity.getDisplayName(); } else { this.entityId = null; this.entityDisplayName = null; } this.tags = task.getTags(); this.displayName = task.getDisplayName(); this.description = task.getDescription(); this.id = task.getId(); this.rawSubmitTimeUtc = task.getSubmitTimeUtc(); this.submitTimeUtc = (task.getSubmitTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getSubmitTimeUtc())); this.startTimeUtc = (task.getStartTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getStartTimeUtc())); this.endTimeUtc = (task.getEndTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getEndTimeUtc())); this.currentStatus = task.getStatusSummary(); this.detailedStatus = task.getStatusDetail(true); }
task.getTags(), ifPositive(task.getSubmitTimeUtc()), ifPositive(task.getStartTimeUtc()), ifPositive(task.getEndTimeUtc()), task.getStatusSummary(), children, asLink(task.getSubmittedByTask()), task instanceof TaskInternal ? asLink(((TaskInternal<?>)task).getBlockingTask()) : null,