Java 类com.datastax.driver.core.exceptions.ReadTimeoutException 实例源码

项目:storm-cassandra-cql    文件:CassandraCqlMapState.java   
protected void checkCassandraException(Exception e) {
    _mexceptions.incr();
    if (e instanceof AlreadyExistsException ||
            e instanceof AuthenticationException ||
            e instanceof DriverException ||
            e instanceof DriverInternalError ||
            e instanceof InvalidConfigurationInQueryException ||
            e instanceof InvalidQueryException ||
            e instanceof InvalidTypeException ||
            e instanceof QueryExecutionException ||
            e instanceof QueryTimeoutException ||
            e instanceof QueryValidationException ||
            e instanceof ReadTimeoutException ||
            e instanceof SyntaxError ||
            e instanceof TraceRetrievalException ||
            e instanceof TruncateException ||
            e instanceof UnauthorizedException ||
            e instanceof UnavailableException ||
            e instanceof ReadTimeoutException ||
            e instanceof WriteTimeoutException) {
        throw new ReportedFailedException(e);
    } else {
        throw new RuntimeException(e);
    }
}
项目:simulacron    文件:ErrorResultIntegrationTest.java   
@Test
public void testShouldReturnReadTimeout() throws Exception {
  server.prime(when(query).then(readTimeout(ConsistencyLevel.TWO, 1, 2, false)));

  thrown.expect(ReadTimeoutException.class);
  thrown.expect(
      match(
          (ReadTimeoutException rte) ->
              rte.getRequiredAcknowledgements() == 2
                  && rte.getReceivedAcknowledgements() == 1
                  && !rte.wasDataRetrieved()
                  && rte.getConsistencyLevel() == com.datastax.driver.core.ConsistencyLevel.TWO));
  query();
}
项目:ignite    文件:CassandraHelper.java   
/**
 * Checks if Cassandra host availability error occur, thus host became unavailable.
 *
 * @param e Exception to check.
 * @return {@code true} in case of host not available error.
 */
public static boolean isHostsAvailabilityError(Throwable e) {
    while (e != null) {
        if (e instanceof NoHostAvailableException ||
            e instanceof ReadTimeoutException)
            return true;

        e = e.getCause();
    }

    return false;
}
项目:scassandra-example-java    文件:PersonDaoCassandra.java   
@Override
public List<Person> retrievePeople() {
    ResultSet result;
    try {
        Statement statement = new SimpleStatement("select * from person");
        statement.setConsistencyLevel(ConsistencyLevel.QUORUM);
        result = session.execute(statement);
    } catch (ReadTimeoutException e) {
        throw new UnableToRetrievePeopleException();
    }

    return result.all().stream().map(
            row -> new Person(row.getString("first_name"), row.getString("last_name"), row.getInt("age"), row.getSet("interesting_dates", Date.class))
    ).collect(Collectors.toList());
}