示例#1
0
  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());
    }
  }
示例#2
0
  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);
    }
  }
示例#3
0
 public void removeRef(String referenceId) {
   lastTasks.remove(referenceId);
   firstTasks.remove(referenceId);
   refCounts.remove(referenceId);
 }