mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-01 16:51:28 +01:00
Simplify maps used in flow store's InternalFlowTable
Change-Id: I66c0c2a0c71b212e5c791280267792f74fb51bf5
This commit is contained in:
parent
711db55d75
commit
5c3766c9a4
@ -30,7 +30,6 @@ import org.apache.felix.scr.annotations.Reference;
|
||||
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||
import org.apache.felix.scr.annotations.Service;
|
||||
import org.onlab.util.KryoNamespace;
|
||||
import org.onlab.util.NewConcurrentHashMap;
|
||||
import org.onlab.util.Tools;
|
||||
import org.onosproject.cfg.ComponentConfigService;
|
||||
import org.onosproject.cluster.ClusterService;
|
||||
@ -76,8 +75,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@ -86,7 +83,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static org.onlab.util.Tools.get;
|
||||
import static org.onlab.util.Tools.groupedThreads;
|
||||
@ -595,17 +591,13 @@ public class NewDistributedFlowRuleStore
|
||||
|
||||
private class InternalFlowTable implements ReplicaInfoEventListener {
|
||||
|
||||
private final ConcurrentMap<DeviceId, ConcurrentMap<FlowId, Set<StoredFlowEntry>>>
|
||||
flowEntries = new ConcurrentHashMap<>();
|
||||
private final Map<DeviceId, Map<FlowId, Set<StoredFlowEntry>>>
|
||||
flowEntries = Maps.newConcurrentMap();
|
||||
|
||||
private final Map<DeviceId, Long> lastBackupTimes = Maps.newConcurrentMap();
|
||||
private final Map<DeviceId, Long> lastUpdateTimes = Maps.newConcurrentMap();
|
||||
private final Map<DeviceId, NodeId> lastBackupNodes = Maps.newConcurrentMap();
|
||||
|
||||
private NewConcurrentHashMap<FlowId, Set<StoredFlowEntry>> lazyEmptyFlowTable() {
|
||||
return NewConcurrentHashMap.<FlowId, Set<StoredFlowEntry>>ifNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void event(ReplicaInfoEvent event) {
|
||||
if (!backupEnabled) {
|
||||
@ -682,8 +674,8 @@ public class NewDistributedFlowRuleStore
|
||||
* @param deviceId identifier of the device
|
||||
* @return Map representing Flow Table of given device.
|
||||
*/
|
||||
private ConcurrentMap<FlowId, Set<StoredFlowEntry>> getFlowTable(DeviceId deviceId) {
|
||||
return createIfAbsentUnchecked(flowEntries, deviceId, lazyEmptyFlowTable());
|
||||
private Map<FlowId, Set<StoredFlowEntry>> getFlowTable(DeviceId deviceId) {
|
||||
return flowEntries.computeIfAbsent(deviceId, id -> Maps.newConcurrentMap());
|
||||
}
|
||||
|
||||
private Set<StoredFlowEntry> getFlowEntriesInternal(DeviceId deviceId, FlowId flowId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user