Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2595

Every protocol should implement up(MessageBatch)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 5.2
    • None
    • None
    • False
    • False

      The code in the superclass of every protocol is (from Protocol)

      public void up(MessageBatch batch) {
              for(Iterator<Message> it=batch.iterator(); it.hasNext();) {
                  Message msg=it.next();
                  if(msg != null && accept(msg)) {
                      it.remove();
                      try {
                          up(msg);
                      }
                      catch(Throwable t) {
                          log.error(Util.getMessage("PassUpFailure"), t);
                      }
                  }
              }
              if(!batch.isEmpty())
                  up_prot.up(batch);
          }
      

      This means that we'll iterate through the batch and call accept() for every messages, although this may not be needed.

      Two solutions:

      • Implement up(MessageBatch) in Protocol to call up_prot.up(batch) (simply pass the batch up). Make sure that none of the protocols rely on the above code to call accept()
      • Have every protocol implement up(MessageBatch)

              rhn-engineering-bban Bela Ban
              rhn-engineering-bban Bela Ban
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: