Fix modernization issues
[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 class EventSourceRegistrationImpl<T extends EventSource> extends AbstractObjectRegistration<T>
17         implements EventSourceRegistration<T> {
18
19     private final EventSourceTopology eventSourceTopology;
20
21     /**
22      * Constructor.
23      *
24      * @param instance of EventSource that has been registered by
25      *     {@link EventSourceRegistryImpl#registerEventSource(Node, EventSource)}
26      */
27     EventSourceRegistrationImpl(T instance, EventSourceTopology eventSourceTopology) {
28         super(instance);
29         this.eventSourceTopology = requireNonNull(eventSourceTopology);
30     }
31
32     @Override
33     protected void removeRegistration() {
34         this.eventSourceTopology.unRegister(getInstance());
35     }
36 }