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 InterfaceRemoveWorkerOnElanInterface implements Callable<List<? extends ListenableFuture<?>>> {
21 private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElanInterface.class);
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;
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;
39 public String toString() {
40 return "InterfaceRemoveWorkerOnElanInterface [key=" + interfaceName + ", elanInfo=" + elanInfo
41 + ", interfaceInfo=" + interfaceInfo + ", isLastElanInterface=" + isLastElanInterface + "]";
45 @SuppressWarnings("checkstyle:IllegalCatch")
46 public List<ListenableFuture<Void>> call() {
48 return dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName,
50 } catch (RuntimeException e) {
51 return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);