예제 #1
0
public class ImmediateDispatcher implements MessageDispatcher {

  private final Logger log =
      Logger.getLogger(com / amazon / mcc / nps / broker / dispatch / ImmediateDispatcher);

  public ImmediateDispatcher() {}

  public void notifyObservers(List list, Topic topic, Message message) {
    if (list == null || list.size() == 0) {
      log.v("Attempted to dispatch message to empty observers");
    } else {
      log.v(
          (new StringBuilder())
              .append("Immediately dispatching: T: ")
              .append(topic.getIdentifier())
              .append(" M: ")
              .append(message.getClass().getName())
              .toString());
      list = list.iterator();
      while (list.hasNext()) {
        ((Observer) list.next()).onUpdate(topic, message);
      }
    }
  }
}
예제 #2
0
 public void notifyObservers(List list, Topic topic, Message message) {
   if (list == null || list.size() == 0) {
     log.v("Attempted to dispatch message to empty observers");
   } else {
     log.v(
         (new StringBuilder())
             .append("Immediately dispatching: T: ")
             .append(topic.getIdentifier())
             .append(" M: ")
             .append(message.getClass().getName())
             .toString());
     list = list.iterator();
     while (list.hasNext()) {
       ((Observer) list.next()).onUpdate(topic, message);
     }
   }
 }