ListenerNotification.java

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

  2. import java.util.Date;

  3. import gov.usgs.earthquake.distribution.NotificationEvent;
  4. import gov.usgs.earthquake.product.ProductId;

  5. /**
  6.  * Track notification for a specific listener.
  7.  */
  8. public class ListenerNotification {

  9.     /** The notification to deliver. */
  10.     public final NotificationEvent event;
  11.     /** The number of attempts to deliver. */
  12.     public int attempts;
  13.     /** Time of the last attempt. */
  14.     public Date lastAttempt;

  15.     /**
  16.      * Create a new ListenerNotification.
  17.      *
  18.      * @param event
  19.      *            the notification to deliver.
  20.      */
  21.     public ListenerNotification(final NotificationEvent event) {
  22.         this.event = event;
  23.         this.attempts = 0;
  24.         this.lastAttempt = null;
  25.     }

  26.     /**
  27.      * @return the product id from the notification.
  28.      */
  29.     public ProductId getProductId() {
  30.         return this.event.getNotification().getProductId();
  31.     }

  32. }