J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package com.sun.jmx.remote.internal; |
| 27 | |
| 28 | import java.util.Set; |
| 29 | import javax.management.remote.NotificationResult; |
| 30 | import javax.management.remote.TargetedNotification; |
| 31 | |
| 32 | /** A buffer of notifications received from an MBean server. */ |
| 33 | public interface NotificationBuffer { |
| 34 | /** |
| 35 | * <p>Fetch notifications that match the given listeners.</p> |
| 36 | * |
| 37 | * <p>The operation only considers notifications with a sequence |
| 38 | * number at least <code>startSequenceNumber</code>. It will take |
| 39 | * no longer than <code>timeout</code>, and will return no more |
| 40 | * than <code>maxNotifications</code> different notifications.</p> |
| 41 | * |
| 42 | * <p>If there are no notifications matching the criteria, the |
| 43 | * operation will block until one arrives, subject to the |
| 44 | * timeout.</p> |
| 45 | * |
| 46 | * @param filter an object that will add notifications to a |
| 47 | * {@code List<TargetedNotification>} if they match the current |
| 48 | * listeners with their filters. |
| 49 | * @param startSequenceNumber the first sequence number to |
| 50 | * consider. |
| 51 | * @param timeout the maximum time to wait. May be 0 to indicate |
| 52 | * not to wait if there are no notifications. |
| 53 | * @param maxNotifications the maximum number of notifications to |
| 54 | * return. May be 0 to indicate a wait for eligible notifications |
| 55 | * that will return a usable <code>nextSequenceNumber</code>. The |
| 56 | * {@link TargetedNotification} array in the returned {@link |
| 57 | * NotificationResult} may contain more than this number of |
| 58 | * elements but will not contain more than this number of |
| 59 | * different notifications. |
| 60 | */ |
| 61 | public NotificationResult |
| 62 | fetchNotifications(NotificationBufferFilter filter, |
| 63 | long startSequenceNumber, |
| 64 | long timeout, |
| 65 | int maxNotifications) |
| 66 | throws InterruptedException; |
| 67 | |
| 68 | /** |
| 69 | * <p>Discard this buffer.</p> |
| 70 | */ |
| 71 | public void dispose(); |
| 72 | } |