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;
14 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
15 import org.opendaylight.netvirt.elan.utils.ElanUtils;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<? extends ListenableFuture<?>>> {
22 private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElanInterface.class);
24 private final String interfaceName;
25 private final ElanInstance elanInfo;
26 private final InterfaceInfo interfaceInfo;
27 private final ElanInterfaceManager dataChangeListener;
28 private final boolean isLastElanInterface;
30 public InterfaceRemoveWorkerOnElanInterface(String interfaceName, ElanInstance elanInfo,
31 InterfaceInfo interfaceInfo, ElanInterfaceManager dataChangeListener, boolean isLastElanInterface) {
32 this.interfaceName = interfaceName;
33 this.elanInfo = elanInfo;
34 this.interfaceInfo = interfaceInfo;
35 this.dataChangeListener = dataChangeListener;
36 this.isLastElanInterface = isLastElanInterface;
40 public String toString() {
41 return "InterfaceRemoveWorkerOnElanInterface [key=" + interfaceName + ", elanInfo=" + elanInfo
42 + ", interfaceInfo=" + interfaceInfo + ", isLastElanInterface=" + isLastElanInterface + "]";
46 @SuppressWarnings("checkstyle:IllegalCatch")
47 public List<ListenableFuture<Void>> call() {
49 return dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName,
51 } catch (RuntimeException e) {
52 return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);