case RESULT:
if (((Responses.Result)response).kind == Responses.Result.Kind.PREPARED) {
logger.debug("Scheduling retry now that query is prepared");
retry(true, null);
} else {
logError(connection.address, new DriverException("Got unexpected response to prepare message: " + response));
retry(false, null);
}
break;
case ERROR:
logError(connection.address, new DriverException("Error preparing query, got " + response));
if (metricsEnabled())
metrics().getErrorMetrics().getOthers().inc();
retry(false, null);
break;
default:
// Something's wrong, so we return but we let setFinalResult propagate the exception
RequestHandler.this.setFinalResult(connection, response);
break;
}
}
@Override
public void onException(Connection connection, Exception exception, long latency) {
RequestHandler.this.onException(connection, exception, latency);
}
@Override
public void onTimeout(Connection connection, long latency) {
logError(connection.address, new DriverException("Timeout waiting for response to prepare message"));
retry(false, null);
}
};
}