fb499c76722de14aed713dbec9f6c67c668c845f
[openflowplugin.git] / applications / reconciliation-framework / src / main / java / org / opendaylight / openflowplugin / applications / reconciliation / impl / ReconciliationServiceDelegate.java
1 /*
2  * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.openflowplugin.applications.reconciliation.impl;
10
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.openflowplugin.applications.reconciliation.NotificationRegistration;
13 import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationNotificationListener;
14
15 public class ReconciliationServiceDelegate implements NotificationRegistration {
16
17     private final ReconciliationNotificationListener reconciliationNotificationListener;
18     private final AutoCloseable unregisterService;
19
20     public ReconciliationServiceDelegate(ReconciliationNotificationListener reconciliationNotificationListener,
21                                          AutoCloseable unregisterService) {
22         this.reconciliationNotificationListener = Preconditions.checkNotNull(reconciliationNotificationListener,
23                                                                              "ReconciliationNotificationListener can "
24                                                                                      + "not be null!");
25         this.unregisterService = unregisterService;
26     }
27
28     @Override
29     public void close() throws Exception {
30         this.unregisterService.close();
31         this.reconciliationNotificationListener.close();
32     }
33 }