@VisibleForTesting static int getMaxTriesTotal() { return CassandraKeyValueServiceRuntimeConfig.getDefault().numberOfRetriesOnAllHosts(); }
/** * This is the maximum number of times we'll accept connection failures to one host before blacklisting it. Note * that subsequent hosts we try in the same call will actually be blacklisted after one connection failure */ @VisibleForTesting static int getMaxRetriesPerHost() { return CassandraKeyValueServiceRuntimeConfig.getDefault().numberOfRetriesOnSameHost(); }
@VisibleForTesting Supplier<CassandraKeyValueServiceRuntimeConfig> preprocessKvsRuntimeConfig( Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig) { return () -> { Optional<KeyValueServiceRuntimeConfig> configOptional = runtimeConfig.get(); return configOptional.map(config -> { if (!(config instanceof CassandraKeyValueServiceRuntimeConfig)) { log.error("Invalid KeyValueServiceRuntimeConfig. Expected a KeyValueServiceRuntimeConfig of type" + " CassandraKeyValueServiceRuntimeConfig, found %s." + " Using latest valid CassandraKeyValueServiceRuntimeConfig.", config.getClass()); return latestValidRuntimeConfig; } latestValidRuntimeConfig = (CassandraKeyValueServiceRuntimeConfig) config; return latestValidRuntimeConfig; }).orElse(CassandraKeyValueServiceRuntimeConfig.getDefault()); }; }
/** * This is the maximum number of times we'll accept connection failures to one host before blacklisting it. Note * that subsequent hosts we try in the same call will actually be blacklisted after one connection failure */ @VisibleForTesting static int getMaxRetriesPerHost() { return CassandraKeyValueServiceRuntimeConfig.getDefault().numberOfRetriesOnSameHost(); }
@VisibleForTesting Supplier<CassandraKeyValueServiceRuntimeConfig> preprocessKvsRuntimeConfig( Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig) { return () -> { Optional<KeyValueServiceRuntimeConfig> configOptional = runtimeConfig.get(); return configOptional.map(config -> { if (!(config instanceof CassandraKeyValueServiceRuntimeConfig)) { log.error("Invalid KeyValueServiceRuntimeConfig. Expected a KeyValueServiceRuntimeConfig of type" + " CassandraKeyValueServiceRuntimeConfig, found %s." + " Using latest valid CassandraKeyValueServiceRuntimeConfig.", config.getClass()); return latestValidRuntimeConfig; } latestValidRuntimeConfig = (CassandraKeyValueServiceRuntimeConfig) config; return latestValidRuntimeConfig; }).orElse(CassandraKeyValueServiceRuntimeConfig.getDefault()); }; }
@VisibleForTesting static int getMaxTriesTotal() { return CassandraKeyValueServiceRuntimeConfig.getDefault().numberOfRetriesOnAllHosts(); }