use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderCustomizeControlConnectionOptions.
@Test
void driverConfigLoaderCustomizeControlConnectionOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.controlconnection.timeout=200ms").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.CONTROL_CONNECTION_TIMEOUT)).isEqualTo(200);
});
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project zeppelin by apache.
the class CassandraInterpreterTest method should_set_custom_option.
@Test
public void should_set_custom_option() {
assertThat(interpreter.session).isNotNull();
DriverExecutionProfile config = interpreter.session.getContext().getConfig().getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE, 10)).isEqualTo(1);
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class ContinuousRequestHandlerBase method onThrottleFailure.
@Override
public void onThrottleFailure(@NonNull RequestThrottlingException error) {
DriverExecutionProfile executionProfile = Conversions.resolveExecutionProfile(initialStatement, context);
session.getMetricUpdater().incrementCounter(DefaultSessionMetric.THROTTLING_ERRORS, executionProfile.getName());
abortGlobalRequestOrChosenCallback(error);
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class ContinuousRequestHandlerBase method onThrottleReady.
// MAIN LIFECYCLE
@Override
public void onThrottleReady(boolean wasDelayed) {
DriverExecutionProfile executionProfile = Conversions.resolveExecutionProfile(initialStatement, context);
if (wasDelayed && // avoid call to nanoTime() if metric is disabled:
sessionMetricUpdater.isEnabled(DefaultSessionMetric.THROTTLING_DELAY, executionProfile.getName())) {
session.getMetricUpdater().updateTimer(DefaultSessionMetric.THROTTLING_DELAY, executionProfile.getName(), System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS);
}
activeExecutionsCount.incrementAndGet();
sendRequest(initialStatement, null, 0, 0, specExecEnabled);
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class Reflection method buildFromConfig.
/**
* @param profileName if null, this is a global policy, use the default profile and look for a
* one-arg constructor. If not null, this is a per-profile policy, look for a two-arg
* constructor.
*/
public static <ComponentT> Optional<ComponentT> buildFromConfig(InternalDriverContext context, String profileName, DriverOption classNameOption, Class<ComponentT> expectedSuperType, String... defaultPackages) {
DriverExecutionProfile config = (profileName == null) ? context.getConfig().getDefaultProfile() : context.getConfig().getProfile(profileName);
String configPath = classNameOption.getPath();
LOG.debug("Creating a {} from config option {}", expectedSuperType.getSimpleName(), configPath);
if (!config.isDefined(classNameOption)) {
LOG.debug("Option is not defined, skipping");
return Optional.empty();
}
String className = config.getString(classNameOption);
return Optional.of(resolveClass(context, profileName, expectedSuperType, configPath, className, defaultPackages));
}
Aggregations