Cleanup QueuedNotificationManager
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / concurrent / NotificationManager.java
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.yangtools.util.concurrent;
10
11 import java.util.concurrent.RejectedExecutionException;
12
13 /**
14  * Interface for a class that manages queuing and dispatching notifications for multiple listeners.
15  *
16  * @author Thomas Pantelis
17  *
18  * @param <L> the listener type
19  * @param <N> the notification type
20  */
21 public interface NotificationManager<L, N> {
22
23     /**
24      * Submits a notification to be queued and dispatched to the given listener.
25      *
26      * <p><b>Note:</b> This method may block if the listener queue is currently full.
27      *
28      * @param listener the listener to notify
29      * @param notification the notification to dispatch
30      * @throws RejectedExecutionException if the notification can't be queued for dispatching
31      */
32     void submitNotification(L listener, N notification);
33
34     /**
35      * Submits notifications to be queued and dispatched to the given listener.
36      *
37      * <p><b>Note:</b> This method may block if the listener queue is currently full.
38      *
39      * @param listener the listener to notify
40      * @param notifications the notifications to dispatch
41      * @throws RejectedExecutionException if a notification can't be queued for dispatching
42      */
43     void submitNotifications(L listener, Iterable<N> notifications);
44
45 }