Count number of FlowRules in parallel

Change-Id: Iec5ffdac0b46e2103619aad6675ee0f873cbf5e5
This commit is contained in:
Yuta HIGUCHI 2017-06-15 13:30:50 -07:00 committed by Ray Milkey
parent 89ef158917
commit 10e91fb0f7

View File

@ -27,7 +27,6 @@ package org.onosproject.store.flow.impl;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -91,7 +90,7 @@ package org.onosproject.store.flow.impl;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.Futures;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
@ -333,9 +332,9 @@ public class DistributedFlowRuleStore
// make it device specific.
@Override
public int getFlowRuleCount() {
AtomicInteger sum = new AtomicInteger(0);
deviceService.getDevices().forEach(device -> sum.addAndGet(Iterables.size(getFlowEntries(device.id()))));
return sum.get();
return Streams.stream(deviceService.getDevices()).parallel()
.mapToInt(device -> Iterables.size(getFlowEntries(device.id())))
.sum();
}
@Override