1. /*
  2. * @(#)NotificationBuffer.java 1.4 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.jmx.remote.internal;
  8. import java.util.Set;
  9. import javax.management.remote.NotificationResult;
  10. import javax.management.remote.TargetedNotification;
  11. /** A buffer of notifications received from an MBean server. */
  12. public interface NotificationBuffer {
  13. /**
  14. * <p>Fetch notifications that match the given listeners.</p>
  15. *
  16. * <p>The operation only considers notifications with a sequence
  17. * number at least <code>startSequenceNumber</code>. It will take
  18. * no longer than <code>timeout</code>, and will return no more
  19. * than <code>maxNotifications</code> different notifications.</p>
  20. *
  21. * <p>If there are no notifications matching the criteria, the
  22. * operation will block until one arrives, subject to the
  23. * timeout.</p>
  24. *
  25. * @param listeners a Set of {@link ListenerInfo} that reflects
  26. * the filters to be applied to notifications. Accesses to this
  27. * Set are synchronized on the Set object. The Set is consulted
  28. * for selected notifications that are present when the method
  29. * starts, and for selected notifications that arrive while it is
  30. * executing. The contents of the Set can be modified, with
  31. * appropriate synchronization, while the method is running.
  32. * @param startSequenceNumber the first sequence number to
  33. * consider.
  34. * @param timeout the maximum time to wait. May be 0 to indicate
  35. * not to wait if there are no notifications.
  36. * @param maxNotifications the maximum number of notifications to
  37. * return. May be 0 to indicate a wait for eligible notifications
  38. * that will return a usable <code>nextSequenceNumber</code>. The
  39. * {@link TargetedNotification} array in the returned {@link
  40. * NotificationResult} may contain more than this number of
  41. * elements but will not contain more than this number of
  42. * different notifications.
  43. */
  44. public NotificationResult
  45. fetchNotifications(Set/*<ListenerInfo>*/ listeners,
  46. long startSequenceNumber,
  47. long timeout,
  48. int maxNotifications)
  49. throws InterruptedException;
  50. /**
  51. * <p>Discard this buffer.</p>
  52. */
  53. public void dispose();
  54. }