import static java.util.Objects.requireNonNull;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import java.util.Optional;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Stream;
import org.checkerframework.checker.lock.qual.GuardedBy;
import org.checkerframework.checker.lock.qual.Holding;
import org.opendaylight.bgpcep.pcep.topology.provider.session.stats.SessionStateImpl;
@GuardedBy("this")
private final Map<S, PCEPRequest> requests = new HashMap<>();
@GuardedBy("this")
- private final Map<String, ReportedLsp> lspData = new HashMap<>();
+ private final Map<String, ReportedLsp> lspData = new ConcurrentHashMap<>();
private final ServerSessionManager serverSessionManager;
private InstanceIdentifier<PathComputationClient> pccIdentifier;
@GuardedBy("this")
@Override
public int getDelegatedLspsCount() {
- final Stream<ReportedLsp> stream;
- synchronized (this) {
- stream = ImmutableList.copyOf(this.lspData.values()).stream();
- }
-
- return Math.toIntExact(stream
+ return Math.toIntExact(this.lspData.values().stream()
.map(ReportedLsp::getPath).filter(pathList -> pathList != null && !pathList.isEmpty())
// pick the first path, as delegate status should be same in each path
.map(pathList -> pathList.values().iterator().next())