コード例 #1
0
  private void emitCurrentWindowCounts() {
    Map<Object, Long> counts = counter.getCountsThenAdvanceWindow();
    int actualWindowLengthInSeconds = lastModifiedTracker.secondsSinceOldestModification();
    lastModifiedTracker.markAsModified();

    if (actualWindowLengthInSeconds != windowLengthInSeconds) {
      LOG.warn(
          String.format(
              WINDOW_LENGTH_WARNING_TEMPLATE, actualWindowLengthInSeconds, windowLengthInSeconds));
    }

    emit(counts);
  }
コード例 #2
0
 private void countObjAndAck(Tuple tuple) {
   Object obj = tuple.getValue(0); // in terms of a long value.
   counter.incrementCount(obj);
   collector.ack(tuple);
 }