524d97c497fb4459f854e05b416094a43f19aab9
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / impl / BindingDataTreeChangeListenerRegistration.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.md.sal.binding.impl;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
12 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14
15 class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener> extends AbstractListenerRegistration<L> {
16
17     private final ListenerRegistration<BindingDOMDataTreeChangeListenerAdapter> domReg;
18
19     BindingDataTreeChangeListenerRegistration(final L listener,
20             final ListenerRegistration<BindingDOMDataTreeChangeListenerAdapter> domReg) {
21         super(listener);
22         this.domReg = Preconditions.checkNotNull(domReg);
23     }
24
25     @Override
26     protected void removeRegistration() {
27         domReg.close();
28     }
29 }