Skip to content

Commit 29bb280

Browse files
Alexandre Dutraadutra
authored andcommitted
Log query warnings before setting the final result
Motivation: Currently the callback result is set _before_ the query warnings are logged. As a consequence, client code dependent on the callback's completion may get executed before the warnings are logged. Modification: Set the callback result after the query warnings are logged. Result: Client code is guaranteed to be executed after the query warnings are logged.
1 parent 669a4c2 commit 29bb280

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

driver-core/src/main/java/com/datastax/driver/core/RequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ private void setFinalResult(
225225
execution.retryConsistencyLevel,
226226
response.getCustomPayload());
227227
}
228-
callback.onSet(connection, response, info, statement, System.nanoTime() - startTime);
229228
// if the response from the server has warnings, they'll be set on the ExecutionInfo. Log them
230229
// here, unless they've been disabled.
231230
if (response.warnings != null
@@ -234,6 +233,7 @@ private void setFinalResult(
234233
&& logger.isWarnEnabled()) {
235234
logServerWarnings(response.warnings);
236235
}
236+
callback.onSet(connection, response, info, statement, System.nanoTime() - startTime);
237237
} catch (Exception e) {
238238
callback.onException(
239239
connection,

0 commit comments

Comments
 (0)