Пример #1
0
  /**
   * This method only flushes one single stream element from the provided data enumerator. Returns
   * false if the flushing the stream element fails. This method also cleans the prepared statements
   * by removing the listener completely.
   *
   * @param dataEnum
   * @param listener
   * @return
   */
  private boolean flushStreamElement(DataEnumerator dataEnum, DistributionRequest listener) {
    if (listener.isClosed()) {
      logger.debug(
          "Flushing an stream element failed, isClosed=true [Listener: "
              + listener.toString()
              + "]");
      return false;
    }

    if (!dataEnum.hasMoreElements()) {
      logger.debug("Nothing to flush to [Listener: " + listener.toString() + "]");
      return true;
    }

    StreamElement se = dataEnum.nextElement();
    //		boolean success = true;
    boolean success = listener.deliverStreamElement(se);
    if (!success) {
      logger.debug(
          "FLushing an stream element failed, delivery failure [Listener: "
              + listener.toString()
              + "]");
      return false;
    }
    logger.debug("Flushing an stream element succeed [Listener: " + listener.toString() + "]");
    return true;
  }
Пример #2
0
 private void addListenerToCandidates(DistributionRequest listener) {
   /** Locker variable should be modified EXACTLY like candidateListeners variable. */
   logger.debug("Adding the listener: " + listener.toString() + " to the candidates.");
   DataEnumerator dataEnum = makeDataEnum(listener);
   if (dataEnum.hasMoreElements()) {
     candidateListeners.put(listener, dataEnum);
     locker.add(listener);
   }
 }