@Override public <T> ListenableFuture<T> execute(AsyncPreparedStatementCreator preparedStatementCreator, PreparedStatementCallback<T> action) throws DataAccessException { Assert.notNull(preparedStatementCreator, "PreparedStatementCreator must not be null"); Assert.notNull(action, "PreparedStatementCallback object must not be null"); PersistenceExceptionTranslator exceptionTranslator = ex -> translateExceptionIfPossible("PreparedStatementCallback", toCql(preparedStatementCreator), ex); try { if (logger.isDebugEnabled()) { logger.debug("Preparing statement [{}] using {}", toCql(preparedStatementCreator), preparedStatementCreator); } Session currentSession = getCurrentSession(); return new ExceptionTranslatingListenableFutureAdapter<>(new MappingListenableFutureAdapter<>( preparedStatementCreator.createPreparedStatement(currentSession), preparedStatement -> { try { return action.doInPreparedStatement(currentSession, applyStatementSettings(preparedStatement)); } catch (DriverException e) { throw translateException(exceptionTranslator, e); } }), getExceptionTranslator()); } catch (DriverException e) { throw translateException(exceptionTranslator, e); } }
preparedStatementCreator.createPreparedStatement(session), preparedStatement -> { if (logger.isDebugEnabled()) { logger.debug("Executing prepared statement [{}]", preparedStatement);