Separate out {Identity,Equality}QueuedNotificationManager
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / concurrent / IdentityQueuedNotificationManager.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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 package org.opendaylight.yangtools.util.concurrent;
9
10 import com.google.common.annotations.Beta;
11 import java.util.concurrent.Executor;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.util.ForwardingIdentityObject;
14 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager.BatchedInvoker;
15
16 @Beta
17 @NonNullByDefault
18 public class IdentityQueuedNotificationManager<L, N>
19         extends AbstractQueuedNotificationManager<ForwardingIdentityObject<L>, L, N> {
20     public IdentityQueuedNotificationManager(final String name, final Executor executor, final int maxQueueCapacity,
21         final BatchedInvoker<L, N> listenerInvoker) {
22         super(name, executor, maxQueueCapacity, listenerInvoker);
23     }
24
25     @Override
26     final ForwardingIdentityObject<L> wrap(final L listener) {
27         return ForwardingIdentityObject.of(listener);
28     }
29
30     @Override
31     final L unwrap(final ForwardingIdentityObject<L> key) {
32         return key.getDelegate();
33     }
34 }