new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(query)); c.write(future); Row row = future.get().one();
if (protocolVersion().compareTo(ProtocolVersion.V4) < 0) { final SettableFuture<?> future = SettableFuture.create(); scheduledTasksExecutor.schedule(
/** * Sets the default fetch size to use for SELECT queries. * * <p>The fetch size set through this method will be use for queries that don't explicitly have a * fetch size, i.e. when {@link Statement#getFetchSize} is less or equal to 0. * * @param fetchSize the new fetch size to set as default. It must be strictly positive but you can * use {@code Integer.MAX_VALUE} to disable paging. * @return this {@code QueryOptions} instance. * @throws IllegalArgumentException if {@code fetchSize <e; 0}. * @throws UnsupportedFeatureException if version 1 of the native protocol is in use and {@code * fetchSize != Integer.MAX_VALUE} as paging is not supported by version 1 of the protocol. * See {@link Cluster.Builder#withProtocolVersion} for more details on protocol versions. */ public QueryOptions setFetchSize(int fetchSize) { if (fetchSize <= 0) throw new IllegalArgumentException("Invalid fetchSize, should be > 0, got " + fetchSize); ProtocolVersion version = manager == null ? null : manager.protocolVersion(); if (fetchSize != Integer.MAX_VALUE && version == ProtocolVersion.V1) throw new UnsupportedFeatureException(version, "Paging is not supported"); this.fetchSize = fetchSize; return this; }
public void ensurePoolsSizing() { if (protocolVersion().compareTo(ProtocolVersion.V3) >= 0) return; for (SessionManager session : sessions) { for (HostConnectionPool pool : session.pools.values()) pool.ensureCoreConnections(); } }
@Override public void run() { DefaultResultSetFuture actualFuture = new DefaultResultSetFuture(SessionManager.this, cluster.manager.protocolVersion(), makeRequestMessage(statement, null)); execute(actualFuture, statement); chainedFuture.setSource(actualFuture); } }, executor());
@Override public void run() { DefaultResultSetFuture actualFuture = new DefaultResultSetFuture(SessionManager.this, cluster.manager.protocolVersion(), makeRequestMessage(statement, null)); execute(actualFuture, statement); chainedFuture.setSource(actualFuture); } }, executor());
/** * Creates a tuple type given a list of types. * * @param types the types for the tuple type. * @return the newly created tuple type. */ public TupleType newTupleType(List<DataType> types) { return new TupleType(types, cluster.protocolVersion(), cluster.configuration.getCodecRegistry()); }
public void ensurePoolsSizing() { if (protocolVersion().compareTo(ProtocolVersion.V3) >= 0) return; for (SessionManager session : sessions) { for (HostConnectionPool pool : session.pools.values()) pool.ensureCoreConnections(); } }
/** * Creates a tuple type given a list of types. * * @param types the types for the tuple type. * @return the newly created tuple type. */ public TupleType newTupleType(List<DataType> types) { return new TupleType(types, cluster.protocolVersion(), cluster.configuration.getCodecRegistry()); }
public void ensurePoolsSizing() { if (protocolVersion().compareTo(ProtocolVersion.V3) >= 0) return; for (SessionManager session : sessions) { for (HostConnectionPool pool : session.pools.values()) pool.ensureCoreConnections(); } }
cassandraVersion = cluster.protocolVersion().minCassandraVersion(); logger.warn( "Cannot find Cassandra version for host {} to parse the schema, using {} based on protocol version in use. "
configuration.getPoolingOptions().setProtocolVersion(protocolVersion());
null, cluster.protocolVersion(), new Requests.Query(SELECT_LOCAL)); ListenableFuture<ResultSet> peersFuture = selectPeersFuture(connection); connection.write(localFuture);
ProtocolVersion protocolVersion = cluster.manager.protocolVersion(); CodecRegistry codecRegistry = cluster.manager.configuration.getCodecRegistry();
DefaultResultSetFuture peersV2Future = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_PEERS_V2)); connection.write(peersV2Future); final SettableFuture<ResultSet> peersFuture = SettableFuture.create(); DefaultResultSetFuture peersFuture = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_PEERS)); connection.write(peersFuture); return peersFuture;
DefaultResultSetFuture future = new DefaultResultSetFuture( this, cluster.manager.protocolVersion(), makeRequestMessage(statement, null)); execute(future, statement); return future;
private static boolean checkSchemaAgreement(Connection connection, Cluster.Manager cluster) throws InterruptedException, ExecutionException { DefaultResultSetFuture peersFuture = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_SCHEMA_PEERS)); DefaultResultSetFuture localFuture = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_SCHEMA_LOCAL)); connection.write(peersFuture); connection.write(localFuture); Set<UUID> versions = new HashSet<UUID>(); Row localRow = localFuture.get().one(); if (localRow != null && !localRow.isNull("schema_version")) versions.add(localRow.getUUID("schema_version")); for (Row row : peersFuture.get()) { InetSocketAddress addr = nativeAddressForPeerHost(row, connection.address, cluster); if (addr == null || row.isNull("schema_version")) continue; Host peer = cluster.metadata.getHost(addr); if (peer != null && peer.isUp()) versions.add(row.getUUID("schema_version")); } logger.debug("Checking for schema agreement: versions are {}", versions); return versions.size() <= 1; }
/** * Creates a tuple type given a list of types. * * @param types the types for the tuple type. * @return the newly created tuple type. */ public TupleType newTupleType(List<DataType> types) { return new TupleType( types, cluster.protocolVersion(), cluster.configuration.getCodecRegistry()); }
public void ensurePoolsSizing() { if (protocolVersion().compareTo(ProtocolVersion.V3) >= 0) return; for (SessionManager session : sessions) { for (HostConnectionPool pool : session.pools.values()) pool.ensureCoreConnections(); } }
@Override public void run() { DefaultResultSetFuture actualFuture = new DefaultResultSetFuture( SessionManager.this, cluster.manager.protocolVersion(), makeRequestMessage(statement, null)); execute(actualFuture, statement); chainedFuture.setSource(actualFuture); } },