use of com.linkedin.d2.backuprequests.BackupRequestsStrategyFromConfig in project rest.li by linkedin.
the class BackupRequestsClient method getStrategyAfterUpdate.
/*private*/
Optional<TrackingBackupRequestsStrategy> getStrategyAfterUpdate(final String serviceName, final String operation) {
Map<String, BackupRequestsStrategyFromConfig> strategiesForOperation = _strategies.get(serviceName);
if (strategiesForOperation != null) {
BackupRequestsStrategyFromConfig backupRequestsStrategyFromConfig = strategiesForOperation.get(operation);
if (backupRequestsStrategyFromConfig != null) {
return backupRequestsStrategyFromConfig.getStrategy();
}
}
LOG.debug("No backup requests strategy found");
return Optional.empty();
}
use of com.linkedin.d2.backuprequests.BackupRequestsStrategyFromConfig in project rest.li by linkedin.
the class BackupRequestsClient method updateBackupRequestsStrategyFromConfig.
private BackupRequestsStrategyFromConfig updateBackupRequestsStrategyFromConfig(String serviceName, String operation, BackupRequestsStrategyFromConfig existing, Map<String, Object> config) {
if (existing == null) {
BackupRequestsStrategyFromConfig newOne = new BackupRequestsStrategyFromConfig(config);
newOne.getStrategy().ifPresent(statsProvider -> _statsConsumer.ifPresent(consumer -> consumer.addStatsProvider(serviceName, operation, statsProvider)));
return newOne;
} else {
BackupRequestsStrategyFromConfig newOne = existing.update(config);
if (newOne != existing) {
// reference inequality
_statsConsumer.ifPresent(consumer -> {
existing.getStrategy().ifPresent(statsProvider -> {
consumer.removeStatsProvider(serviceName, operation, statsProvider);
// Make sure latencies for all outstanding requests get recorded
FinalSweepLatencyNotification fsln = new FinalSweepLatencyNotification(serviceName, operation, statsProvider);
_finalSweepLatencyNotification.put(fsln, fsln);
});
newOne.getStrategy().ifPresent(statsProvider -> consumer.addStatsProvider(serviceName, operation, statsProvider));
});
}
return newOne;
}
}
Aggregations