public void remove(Task t) { if (StringUtils.isEmpty(t.getReferenceId())) { return; } long count = refCounts.decrement(t.getReferenceId(), 1); if (count < 1) { firstTasks.remove(t.getReferenceId()); lastTasks.remove(t.getReferenceId()); } }
public void add(Task t) { if (StringUtils.isEmpty(t.getReferenceId())) { return; } refCounts.increment(t.getReferenceId(), 1); TaskOrderInfo newTask = new TaskOrderInfo(t, orderCount.incrementAndGet()); TaskOrderInfo firstTask = firstTasks.get(t.getReferenceId()); if (newTask.isBefore(firstTask)) { firstTasks.put(t.getReferenceId(), newTask); } TaskOrderInfo lastTask = lastTasks.get(t.getReferenceId()); if (newTask.isAfter(lastTask)) { lastTasks.put(t.getReferenceId(), newTask); } }
public void removeRef(String referenceId) { lastTasks.remove(referenceId); firstTasks.remove(referenceId); refCounts.remove(referenceId); }