Java Code Examples for com.datastax.driver.core.PreparedStatement#setRetryPolicy()

The following examples show how to use com.datastax.driver.core.PreparedStatement#setRetryPolicy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraPreparedBuilder.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
public PreparedStatement prepare(Session session, String query, ConsistencyLevel consistency, RetryPolicy retryPolicy) {
   PreparedStatement ps = session.prepare(query);
   ps.setConsistencyLevel(consistency);
   if(retryPolicy != null) {
      ps.setRetryPolicy(retryPolicy);
   }
   return ps;
}
 
Example 2
Source File: CassandraStorage.java    From copper-engine with Apache License 2.0 5 votes vote down vote up
private void prepare(String cql, RetryPolicy petryPolicy) {
    logger.info("Preparing cql stmt {}", cql);
    PreparedStatement pstmt = session.prepare(cql);
    pstmt.setConsistencyLevel(consistencyLevel);
    pstmt.setRetryPolicy(petryPolicy);
    pstmt.setIdempotent(true);
    preparedStatements.put(cql, pstmt);
}