ListenerNotificationQueue.java

  1. package gov.usgs.earthquake.distribution.roundrobinnotifier;

  2. import gov.usgs.earthquake.product.ProductId;
  3. import gov.usgs.earthquake.util.RoundRobinBlockingQueue;

  4. /**
  5.  * A round-robin blocking queue for ListenerNotification objects.
  6.  */
  7. public class ListenerNotificationQueue extends
  8.         RoundRobinBlockingQueue<ListenerNotification> {

  9.     /**
  10.      * Round robin per source + type.
  11.      */
  12.     @Override
  13.     protected String getQueueId(final ListenerNotification notification) {
  14.         ProductId id = notification.getProductId();
  15.         return (id.getSource() + "_" + id.getType()).toLowerCase();
  16.     }

  17. }