+
+ void disableTracking(final ClientIdentifier clientId) {
+ final FrontendIdentifier frontendId = clientId.getFrontendId();
+ final FrontendClientMetadataBuilder client = clients.get(frontendId);
+ if (client == null) {
+ // When we have not 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())) {
+ LOG.debug("{}: disableTracking {} does not match client {}, ignoring", shardName, clientId, client);
+ return;
+ }
+ if (client instanceof FrontendClientMetadataBuilder.Disabled) {
+ LOG.debug("{}: client {} is has already disabled tracking", shardName, client);
+ return;
+ }
+
+ verify(clients.replace(frontendId, client, new FrontendClientMetadataBuilder.Disabled(shardName, clientId)));
+ }
+
+ ImmutableSet<ClientIdentifier> getClients() {
+ return clients.values().stream()
+ .map(FrontendClientMetadataBuilder::getIdentifier)
+ .collect(ImmutableSet.toImmutableSet());
+ }