use of com.datastax.oss.driver.internal.core.tracker.NoopRequestTracker in project java-driver by datastax.
the class CqlRequestHandler method setFinalResult.
private void setFinalResult(Result resultMessage, Frame responseFrame, boolean schemaInAgreement, NodeResponseCallback callback) {
try {
ExecutionInfo executionInfo = buildExecutionInfo(callback, resultMessage, responseFrame, schemaInAgreement);
AsyncResultSet resultSet = Conversions.toResultSet(resultMessage, executionInfo, session, context);
if (result.complete(resultSet)) {
cancelScheduledTasks();
throttler.signalSuccess(this);
// Only call nanoTime() if we're actually going to use it
long completionTimeNanos = NANOTIME_NOT_MEASURED_YET, totalLatencyNanos = NANOTIME_NOT_MEASURED_YET;
if (!(requestTracker instanceof NoopRequestTracker)) {
completionTimeNanos = System.nanoTime();
totalLatencyNanos = completionTimeNanos - startTimeNanos;
long nodeLatencyNanos = completionTimeNanos - callback.nodeStartTimeNanos;
requestTracker.onNodeSuccess(callback.statement, nodeLatencyNanos, callback.executionProfile, callback.node, logPrefix);
requestTracker.onSuccess(callback.statement, totalLatencyNanos, callback.executionProfile, callback.node, logPrefix);
}
if (sessionMetricUpdater.isEnabled(DefaultSessionMetric.CQL_REQUESTS, callback.executionProfile.getName())) {
if (completionTimeNanos == NANOTIME_NOT_MEASURED_YET) {
completionTimeNanos = System.nanoTime();
totalLatencyNanos = completionTimeNanos - startTimeNanos;
}
sessionMetricUpdater.updateTimer(DefaultSessionMetric.CQL_REQUESTS, callback.executionProfile.getName(), totalLatencyNanos, TimeUnit.NANOSECONDS);
}
}
// log the warnings if they have NOT been disabled
if (!executionInfo.getWarnings().isEmpty() && callback.executionProfile.getBoolean(DefaultDriverOption.REQUEST_LOG_WARNINGS) && LOG.isWarnEnabled()) {
logServerWarnings(callback.statement, callback.executionProfile, executionInfo.getWarnings());
}
} catch (Throwable error) {
setFinalError(callback.statement, error, callback.node, -1);
}
}
Aggregations