@FunctionalInterface public interface AsyncPreparedStatementCreator
AsyncCqlTemplate class. This interface prepares a CQL
statement returning a ListenableFuture given a Session, 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.
A AsyncPreparedStatementCreator 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.
AsyncCqlTemplate.execute(AsyncPreparedStatementCreator, PreparedStatementCallback)| Modifier and Type | Method and Description |
|---|---|
ListenableFuture<com.datastax.driver.core.PreparedStatement> |
createPreparedStatement(com.datastax.driver.core.Session session)
Create a statement in this session.
|
ListenableFuture<com.datastax.driver.core.PreparedStatement> createPreparedStatement(com.datastax.driver.core.Session session) throws com.datastax.driver.core.exceptions.DriverException
PreparedStatements. The
CqlTemplate will attempt to cache the PreparedStatements for future use without the overhead of
re-preparing on the entire cluster.session - Session to use to create statement, must not be null.com.datastax.driver.core.exceptions.DriverException - there is no need to catch DriverException that may be thrown in the implementation of this
method. The AsyncCqlTemplate class will handle them.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.