2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
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
8 package org.opendaylight.netvirt.elan.internal;
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;
19 public class InterfaceRemoveWorkerOnElan implements Callable<List<? extends ListenableFuture<?>>> {
21 private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElan.class);
23 private final String key;
24 private final ElanInstance elanInfo;
25 private final String interfaceName;
26 private final InterfaceInfo interfaceInfo;
27 private final ElanInterfaceManager dataChangeListener;
29 public InterfaceRemoveWorkerOnElan(String key, ElanInstance elanInfo, String interfaceName,
30 InterfaceInfo interfaceInfo, ElanInterfaceManager dataChangeListener) {
32 this.elanInfo = elanInfo;
33 this.interfaceName = interfaceName;
34 this.interfaceInfo = interfaceInfo;
35 this.dataChangeListener = dataChangeListener;
39 public String toString() {
40 return "InterfaceRemoveWorkerOnElan [key=" + key + ", elanInfo=" + elanInfo
41 + ", interfaceName=" + interfaceName
42 + ", interfaceInfo=" + interfaceInfo + "]";
46 @SuppressWarnings("checkstyle:IllegalCatch")
47 public List<ListenableFuture<?>> call() {
49 return dataChangeListener.removeElanInterface(elanInfo, interfaceName, interfaceInfo);
50 } catch (RuntimeException e) {
51 return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);