2 * Copyright (c) 2020 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.genius.interfacemanager.listeners;
10 import java.util.concurrent.ConcurrentHashMap;
11 import java.util.concurrent.ConcurrentMap;
12 import javax.inject.Singleton;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
17 public class InternalTunnelCache {
19 private volatile ConcurrentMap<String, Interface> internalTunnelCache = new ConcurrentHashMap<>();
21 public synchronized void add(String tunnelName, Interface iface) {
22 internalTunnelCache.putIfAbsent(tunnelName, iface);
25 public synchronized Interface get(String tunnelName) {
26 return internalTunnelCache.get(tunnelName);
29 public synchronized Interface remove(String tunnelName) {
30 return internalTunnelCache.remove(tunnelName);