Remove GENIUS UTIL references in Elanmanager Module
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / internal / InterfaceRemoveWorkerOnElanInterface.java
1 /*
2  * Copyright (c) 2016 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 package org.opendaylight.netvirt.elan.internal;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
14 import org.opendaylight.netvirt.elan.utils.ElanUtils;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<? extends ListenableFuture<?>>> {
20
21     private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElanInterface.class);
22
23     private final String interfaceName;
24     private final ElanInstance elanInfo;
25     private final InterfaceInfo interfaceInfo;
26     private final ElanInterfaceManager dataChangeListener;
27     private final boolean isLastElanInterface;
28
29     public InterfaceRemoveWorkerOnElanInterface(String interfaceName, ElanInstance elanInfo,
30             InterfaceInfo interfaceInfo, ElanInterfaceManager dataChangeListener, boolean isLastElanInterface) {
31         this.interfaceName = interfaceName;
32         this.elanInfo = elanInfo;
33         this.interfaceInfo = interfaceInfo;
34         this.dataChangeListener = dataChangeListener;
35         this.isLastElanInterface = isLastElanInterface;
36     }
37
38     @Override
39     public String toString() {
40         return "InterfaceRemoveWorkerOnElanInterface [key=" + interfaceName + ", elanInfo=" + elanInfo
41                 + ", interfaceInfo=" + interfaceInfo + ", isLastElanInterface=" + isLastElanInterface + "]";
42     }
43
44     @Override
45     @SuppressWarnings("checkstyle:IllegalCatch")
46     public List<ListenableFuture<?>> call() {
47         try {
48             return dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName,
49                     isLastElanInterface);
50         } catch (RuntimeException e) {
51             return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);
52         }
53     }
54
55 }