2 * Copyright (c) 2019 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
9 package org.opendaylight.genius.interfacemanager.listeners;
11 import java.util.Optional;
12 import java.util.concurrent.ConcurrentHashMap;
13 import java.util.concurrent.ConcurrentMap;
14 import javax.inject.Singleton;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
19 public class MigrationInProgressCache {
21 private final ConcurrentMap<String, NodeConnectorId> migrationInProgressCache = new ConcurrentHashMap<>();
23 protected void put(@NonNull String interfaceName, NodeConnectorId nodeConnectorId) {
24 migrationInProgressCache.put(interfaceName, nodeConnectorId);
27 protected void remove(@NonNull String interfaceName) {
28 migrationInProgressCache.remove(interfaceName);
31 public Optional<NodeConnectorId> get(@NonNull String interfaceName) {
32 return Optional.ofNullable(migrationInProgressCache.get(interfaceName));