package org.opendaylight.controller.cluster.datastore;
import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import java.util.HashMap;
import java.util.Map;
private final String shardName;
FrontendMetadata(final String shardName) {
- this.shardName = Preconditions.checkNotNull(shardName);
+ this.shardName = requireNonNull(shardName);
}
@Override
final FrontendIdentifier frontendId = clientId.getFrontendId();
final FrontendClientMetadataBuilder client = clients.get(frontendId);
if (client == null) {
- LOG.debug("{}: disableTracking {} does not match any client, ignoring", shardName, clientId);
+ // When we havent seen the client before, we still need to disable tracking for him since this only gets
+ // triggered once.
+ LOG.debug("{}: disableTracking {} does not match any client, pre-disabling client.", shardName, clientId);
+ clients.put(frontendId, new FrontendClientMetadataBuilder.Disabled(shardName, clientId));
return;
}
if (!clientId.equals(client.getIdentifier())) {
verify(clients.replace(frontendId, client, new FrontendClientMetadataBuilder.Disabled(shardName, clientId)));
}
+
+ ImmutableSet<ClientIdentifier> getClients() {
+ return clients.values().stream()
+ .map(FrontendClientMetadataBuilder::getIdentifier)
+ .collect(ImmutableSet.toImmutableSet());
+ }
}