@OnScheduled public void onScheduled(final ProcessContext context) { super.onScheduled(context); final int fetchSize = context.getProperty(FETCH_SIZE).evaluateAttributeExpressions().asInteger(); if (fetchSize > 0) { synchronized (cluster.get()) { cluster.get().getConfiguration().getQueryOptions().setFetchSize(fetchSize); } } }
newCluster.getConfiguration().getQueryOptions().setConsistencyLevel(ConsistencyLevel.valueOf(consistencyLevel)); Metadata metadata = newCluster.getMetadata();
@Override long delayMs() { return configuration.getQueryOptions().getRefreshNodeListIntervalMillis(); } };
@Override long delayMs() { return configuration.getQueryOptions().getRefreshSchemaIntervalMillis(); } };
@Override long delayMs() { return configuration.getQueryOptions().getRefreshNodeIntervalMillis(); } };
@Override int maxPendingEvents() { return configuration.getQueryOptions().getMaxPendingRefreshSchemaRequests(); }
@Override int maxPendingEvents() { return configuration.getQueryOptions().getMaxPendingRefreshNodeListRequests(); }
@Override int maxPendingEvents() { return configuration.getQueryOptions().getMaxPendingRefreshNodeRequests(); }
newSession = newCluster.connect(); newCluster.getConfiguration().getQueryOptions().setConsistencyLevel(ConsistencyLevel.valueOf(consistencyLevel)); Metadata metadata = newCluster.getMetadata(); log.info("Connected to Cassandra cluster: {}", new Object[]{metadata.getClusterName()});
@Override public void init(Cluster cluster) { childPolicy.init(cluster); queryOptions = cluster.getConfiguration().getQueryOptions(); }
? configuration.getQueryOptions().getConsistencyLevel() : statement.getConsistencyLevel();
@BeforeMethod(groups = "short") public void setUpDefaultIdempotence() { cluster.getConfiguration().getQueryOptions().setDefaultIdempotence(false); }
ConsistencyLevel cl = statement.getConsistencyLevel() == null ? configuration.getQueryOptions().getConsistencyLevel() : statement.getConsistencyLevel(); if (cl.isDCLocal()) {
@BeforeMethod(groups = {"short"}) public void storeDefaultCL() { defaultCL = cluster.getConfiguration().getQueryOptions().getConsistencyLevel(); }
public RequestHandler(SessionManager manager, Callback callback, Statement statement) { this.id = Long.toString(System.identityHashCode(this)); if (logger.isTraceEnabled()) logger.trace("[{}] {}", id, statement); this.manager = manager; this.callback = callback; this.scheduler = manager.cluster.manager.connectionFactory.timer; callback.register(this); // If host is explicitly set on statement, bypass load balancing policy. if (statement.getHost() != null) { this.queryPlan = new QueryPlan(Iterators.singletonIterator(statement.getHost())); } else { this.queryPlan = new QueryPlan( manager.loadBalancingPolicy().newQueryPlan(manager.poolsState.keyspace, statement)); } this.speculativeExecutionPlan = manager.speculativeExecutionPolicy().newPlan(manager.poolsState.keyspace, statement); this.allowSpeculativeExecutions = statement != Statement.DEFAULT && statement.isIdempotentWithDefault(manager.configuration().getQueryOptions()); this.statement = statement; this.timerContext = metricsEnabled() ? metrics().getRequestsTimer().time() : null; this.startTime = System.nanoTime(); }
pmsg, cluster, query, poolsState.keyspace); stmt = cluster.manager.addPrepared(stmt); if (cluster.getConfiguration().getQueryOptions().isPrepareOnAllHosts()) {
private RetryPolicy.RetryDecision computeRetryDecisionOnRequestError( DriverException exception) { RetryPolicy.RetryDecision decision; if (statement.isIdempotentWithDefault(manager.cluster.getConfiguration().getQueryOptions())) { decision = retryPolicy()
/** * Copy constructor. * * @param toCopy the object to copy from. */ protected Configuration(Configuration toCopy) { this( toCopy.getPolicies(), toCopy.getProtocolOptions(), toCopy.getPoolingOptions(), toCopy.getSocketOptions(), toCopy.getMetricsOptions(), toCopy.getQueryOptions(), toCopy.getThreadingOptions(), toCopy.getNettyOptions(), toCopy.getCodecRegistry()); }
/** * Tests that settings for a debouncer can be modified dynamically without requiring the cluster * to be restarted. * * @throws InterruptedException * @jira_ticket JAVA-1192 */ @CCMConfig(numberOfNodes = 1) @Test(groups = "short") public void should_change_debouncer_settings_dynamically() throws InterruptedException { // Create a spy of the Cluster's control connection and replace it with the spy. ControlConnection controlConnection = spy(cluster().manager.controlConnection); cluster().manager.controlConnection = controlConnection; for (int i = 0; i < 10; i++) { cluster().manager.submitNodeListRefresh(); Thread.sleep(100); } // all requests should be coalesced into a single one verify(controlConnection, timeout(10000)).refreshNodeListAndTokenMap(); reset(controlConnection); // disable debouncing cluster().getConfiguration().getQueryOptions().setRefreshNodeListIntervalMillis(0); for (int i = 0; i < 10; i++) { cluster().manager.submitNodeListRefresh(); Thread.sleep(100); } // each request should have been handled separately verify(controlConnection, timeout(10000).times(10)).refreshNodeListAndTokenMap(); }
throws Exception { try { schemaDisabledCluster.getConfiguration().getQueryOptions().setMetadataEnabled(true); schemaDisabledCluster.getConfiguration().getQueryOptions().setMetadataEnabled(true); verify(schemaDisabledControlConnection, after(1000).never()) .refreshSchema(null, null, null, null); schemaDisabledCluster.getConfiguration().getQueryOptions().setMetadataEnabled(false);