Table 220 flows not removed
[genius.git] / interfacemanager / interfacemanager-impl / src / main / java / org / opendaylight / genius / interfacemanager / listeners / MigrationInProgressCache.java
1 /*
2  * Copyright (c) 2019 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.genius.interfacemanager.listeners;
10
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;
17
18 @Singleton
19 public class MigrationInProgressCache {
20     @NonNull
21     private final ConcurrentMap<String, NodeConnectorId> migrationInProgressCache = new ConcurrentHashMap<>();
22
23     protected void put(@NonNull String interfaceName, NodeConnectorId nodeConnectorId) {
24         migrationInProgressCache.put(interfaceName, nodeConnectorId);
25     }
26
27     protected void remove(@NonNull String interfaceName) {
28         migrationInProgressCache.remove(interfaceName);
29     }
30
31     public Optional<NodeConnectorId> get(@NonNull String interfaceName) {
32         return Optional.ofNullable(migrationInProgressCache.get(interfaceName));
33     }
34 }