Example #1
0
  /**
   * Copy the existing request set map and pass it on to ThreadPool as part of a FlushTask.
   * Initiatize a new map as the new request set map for future remote logging calls.
   */
  public synchronized void nonBlockingFlush() {
    if (recCount <= 0) {
      if (Debug.messageEnabled()) {
        Debug.message("RemoteHandler.nonBlockingFlush(): no records " + "in buffer to send");
      }
      return;
    }

    FlushTask task = new FlushTask(reqSetMap);
    try {
      thread.run(task);
    } catch (ThreadPoolException ex) {
      // Use current thread to complete the task if ThreadPool can not
      // execute it.
      if (Debug.messageEnabled()) {
        Debug.message(
            "RemoteHandler.nonBlockingFlush(): ThreadPoolException"
                + ". Performing blocking flush.");
      }
      task.run();
    }
    this.recCount = 0;
    reqSetMap = new HashMap();
  }