Elffuss BraidHub

kikocis/java-driver public

Merge pull request #480 from datastax/java902

Prepare API for async query trace (JAVA-902).
Changesete25fc31e468922de728bb1d92bb3d21112d4936d016afae16abe96fa07d5d471
AuthorOlivier Michallat <olim7t@users.noreply.github.com> · 2015-10-14 22:05 +02:00
CommitterOlivier Michallat <olim7t@users.noreply.github.com> · 2015-10-14 22:05 +02:00
Parentscf32ad67f65d, 49b6731e451f

Browse the files at this changeset

2 files changed

modified changelog/README.md +1 −0
@@ -7,6 +7,7 @@
77 - [improvement] Don't delay UP/ADDED notifications if protocol version = V4 (JAVA-877)
88 - [improvement] Parse 'extensions' column in table metadata (JAVA-938)
99 - [bug] Fix Configuration builder to allow disabled metrics (JAVA-900)
10+- [new feature] Prepare API for async query trace (JAVA-902)
1011
1112
1213 ### 3.0.0-alpha3
modified driver-core/src/main/java/com/datastax/driver/core/ExecutionInfo.java +22 −1
@@ -20,6 +20,9 @@
2020 import java.util.List;
2121 import java.util.Map;
2222
23+import com.google.common.util.concurrent.Futures;
24+import com.google.common.util.concurrent.ListenableFuture;
25+
2326 import com.datastax.driver.core.utils.Bytes;
2427
2528 /**
@@ -132,7 +135,10 @@
132135 }
133136
134137 /**
135- * The query trace if tracing was enabled on this query.
138+ * Return the query trace if tracing was enabled on this query.
139+ * <p>
140+ * Note that accessing the fields of the the returned object will trigger a
141+ * <b>blocking</b> background query.
136142 *
137143 * @return the {@code QueryTrace} object for this query if tracing was
138144 * enable for this query, or {@code null} otherwise.
@@ -141,6 +147,21 @@
141147 return trace;
142148 }
143149
150+ /**
151+ * Placeholder for async query trace retrieval (not implemented yet).
152+ * <p>
153+ * Async query trace retrieval will be implemented in a future version. This method
154+ * is added now to avoid breaking binary compatibility later.
155+ * The current implementation merely wraps the result of {@link #getQueryTrace()} in
156+ * an immediate future; it will still trigger a blocking query when the query
157+ * trace's fields are accessed.
158+ *
159+ * @return currently, an immediate future containing the result of {@link #getQueryTrace()}.
160+ */
161+ public ListenableFuture<QueryTrace> getQueryTraceAsync() {
162+ return Futures.immediateFuture(trace);
163+ }
164+
144165 /**
145166 * The paging state of the query.
146167 *