Interface AsyncPreparedStatementCreator
- All Known Subinterfaces:
AsyncCassandraTemplate.AsyncPreparedStatementHandler
- All Known Implementing Classes:
AsyncCassandraTemplate.PreparedStatementHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@Deprecated(since="4.0",
forRemoval=true)
@FunctionalInterface
public interface AsyncPreparedStatementCreator
Deprecated, for removal: This API element is subject to removal in a future version.
One of the two central callback interfaces used by the
AsyncCqlTemplate class. This interface prepares a CQL
statement returning a ListenableFuture given a CqlSession, provided by the CqlTemplate class.
Implementations may either create new prepared statements or reuse cached instances. Implementations do not need to
concern themselves with DriverExceptions that may be thrown from operations they attempt. The
AsyncCqlTemplate class will catch and handle
DriverExceptions appropriately.
Classes implementing this interface should also implement the CqlProvider interface if it is able to provide
the CQL it uses for PreparedStatement creation. This allows for better contextual information in case of
exceptions.
- Since:
- 4.0
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionListenableFuture<com.datastax.oss.driver.api.core.cql.PreparedStatement>createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session) Deprecated, for removal: This API element is subject to removal in a future version.Create a statement in this session.
-
Method Details
-
createPreparedStatement
ListenableFuture<com.datastax.oss.driver.api.core.cql.PreparedStatement> createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session) throws com.datastax.oss.driver.api.core.DriverException Deprecated, for removal: This API element is subject to removal in a future version.Create a statement in this session. Allows implementations to usePreparedStatements. TheCqlTemplatewill attempt to cache thePreparedStatements for future use without the overhead of re-preparing on the entire cluster.- Parameters:
session- Session to use to create statement, must not be null.- Returns:
- a prepared statement.
- Throws:
com.datastax.oss.driver.api.core.DriverException- there is no need to catch DriverException that may be thrown in the implementation of this method. TheAsyncCqlTemplateclass will handle them.
-
CompletableFuture-based variant.