1779ad85f8c4306931cf9db2bfa0670eea06905a
[controller.git] / opendaylight / md-sal / messagebus-impl / src / main / java / org / opendaylight / controller / messagebus / app / impl / EventSourceRegistrationImpl.java
1 /*
2  * Copyright (c) 2015 Cisco 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 package org.opendaylight.controller.messagebus.app.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.opendaylight.controller.messagebus.spi.EventSource;
13 import org.opendaylight.controller.messagebus.spi.EventSourceRegistration;
14 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
15
16 @Deprecated(forRemoval = true)
17 class EventSourceRegistrationImpl<T extends EventSource> extends AbstractObjectRegistration<T>
18         implements EventSourceRegistration<T> {
19
20     private final EventSourceTopology eventSourceTopology;
21
22     /**
23      * Constructor.
24      *
25      * @param instance of EventSource that has been registered by
26      *     {@link EventSourceRegistryImpl#registerEventSource(Node, EventSource)}
27      */
28     EventSourceRegistrationImpl(final T instance, final EventSourceTopology eventSourceTopology) {
29         super(instance);
30         this.eventSourceTopology = requireNonNull(eventSourceTopology);
31     }
32
33     @Override
34     protected void removeRegistration() {
35         this.eventSourceTopology.unRegister(getInstance());
36     }
37 }