2 * Copyright © 2015, 2018 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.dhcpservice;
10 import java.util.concurrent.ConcurrentHashMap;
11 import javax.annotation.PostConstruct;
12 import javax.inject.Singleton;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 public class DhcpPortCache {
22 private static final Logger LOG = LoggerFactory.getLogger(DhcpPortCache.class);
23 private final ConcurrentHashMap<String, Port> portMap = new ConcurrentHashMap<>();
27 LOG.trace("Initialize DhcpPortCache. ");
30 public void put(@NonNull String interfaceName, Port port) {
31 portMap.put(interfaceName, port);
32 LOG.trace("Added the interface {} to DhcpPortCache",interfaceName);
36 public Port get(@NonNull String interfaceName) {
37 return portMap.get(interfaceName);
40 public void remove(@NonNull String interfaceName) {
41 portMap.remove(interfaceName);