示例#1
0
  @QueueCallback(QueueCallbackType.LIMIT)
  private void queueLimit() {

    if (messageCountSinceLastFlush > 100_000) {

      now = Timer.timer().now();
      logger.debug(
          "EventManager {}: Sending all " + "messages because we have more than 100K", name);
      sendMessages();
      return;
    }

    now = Timer.timer().now();
    long duration = now - lastFlushTime;

    if (duration > 50 && messageCountSinceLastFlush > 0) {
      if (debug) {
        logger.debug(
            "EventManager {}: Sending all "
                + "messages because 50 MS elapsed and we have more than 0",
            name);
      }
      sendMessages();
    }

    eventBus.flush();
  }
示例#2
0
  @QueueCallback(QueueCallbackType.IDLE)
  private void queueIdle() {

    now = Timer.timer().now();

    if (messageCountSinceLastFlush > 0) {

      sendMessages();
      return;
    }

    eventBus.flush();
  }
示例#3
0
  @QueueCallback(QueueCallbackType.EMPTY)
  private void queueEmpty() {

    if (messageCountSinceLastFlush > 100) {

      now = Timer.timer().now();
      sendMessages();
      return;
    }

    now = Timer.timer().now();
    long duration = now - lastFlushTime;

    if (duration > 20 && messageCountSinceLastFlush > 0) {
      sendMessages();
    }

    eventBus.flush();
  }