kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | b75301e0042a5cda6e0e3a0d75e625ed5a803244e09542b45c3b77671adecd15 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2015-10-07 14:51 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-10-07 14:58 +02:00 |
| Parents | ff3956c82b44 |
5 files changed
modified driver-core/src/main/java/com/datastax/driver/core/AbstractSession.java +1 −1
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | * |
| 30 | 30 | * This is primarly intended to make mocking easier. |
| 31 | 31 | */ |
| 32 | -public abstract class AbstractSession implements Session, AsyncInitSession { | |
| 32 | +public abstract class AbstractSession implements Session { | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * {@inheritDoc} |
deleted driver-core/src/main/java/com/datastax/driver/core/AsyncInitSession.java +0 −36
| @@ -1,36 +0,0 @@ | ||
| 1 | -/* | |
| 2 | - * Copyright (C) 2012-2015 DataStax Inc. | |
| 3 | - * | |
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | - * you may not use this file except in compliance with the License. | |
| 6 | - * You may obtain a copy of the License at | |
| 7 | - * | |
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | - * | |
| 10 | - * Unless required by applicable law or agreed to in writing, software | |
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | - * See the License for the specific language governing permissions and | |
| 14 | - * limitations under the License. | |
| 15 | - */ | |
| 16 | -package com.datastax.driver.core; | |
| 17 | - | |
| 18 | -import com.google.common.util.concurrent.ListenableFuture; | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * A {@link Session} that can be initialized asynchronously. | |
| 22 | - * | |
| 23 | - * This interface exists only for backward compatibility reasons: {@link #initAsync()} should really be | |
| 24 | - * defined by {@link Session}, but adding it after the fact would break binary compatibility. | |
| 25 | - * | |
| 26 | - * By default, all sessions returned by the driver implement this interface. The only way you would get | |
| 27 | - * sessions that don't is if you use a custom {@link Cluster} subclass. | |
| 28 | - */ | |
| 29 | -public interface AsyncInitSession extends Session { | |
| 30 | - /** | |
| 31 | - * Initialize this session asynchronously. | |
| 32 | - * | |
| 33 | - * @return a future that will complete when the session is fully initialized. | |
| 34 | - */ | |
| 35 | - ListenableFuture<Session> initAsync(); | |
| 36 | -} |
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +2 −2
| @@ -336,7 +336,7 @@ | ||
| 336 | 336 | public ListenableFuture<Session> connectAsync(String keyspace) { |
| 337 | 337 | checkNotClosed(manager); |
| 338 | 338 | init(); |
| 339 | - AsyncInitSession session = manager.newSession(keyspace); | |
| 339 | + Session session = manager.newSession(keyspace); | |
| 340 | 340 | return session.initAsync(); |
| 341 | 341 | } |
| 342 | 342 | |
| @@ -1499,7 +1499,7 @@ | ||
| 1499 | 1499 | return translated == null ? sa : translated; |
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | - private AsyncInitSession newSession(String keyspace) { | |
| 1502 | + private Session newSession(String keyspace) { | |
| 1503 | 1503 | SessionManager session = new SessionManager(Cluster.this, keyspace); |
| 1504 | 1504 | sessions.add(session); |
| 1505 | 1505 | return session; |
modified driver-core/src/main/java/com/datastax/driver/core/Session.java +34 −25
| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | * @return the name of the keyspace to which this Session is currently |
| 50 | 50 | * logged in, or {@code null} if the session is logged to no keyspace. |
| 51 | 51 | */ |
| 52 | - public String getLoggedKeyspace(); | |
| 52 | + String getLoggedKeyspace(); | |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Force the initialization of this Session instance if it hasn't been |
| @@ -82,7 +82,16 @@ | ||
| 82 | 82 | * Cluster initialization and an authentication error occurs while contacting |
| 83 | 83 | * the initial contact points. |
| 84 | 84 | */ |
| 85 | - public Session init(); | |
| 85 | + Session init(); | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * Initialize this session asynchronously. | |
| 89 | + * | |
| 90 | + * @return a future that will complete when the session is fully initialized. | |
| 91 | + * | |
| 92 | + * @see #init() | |
| 93 | + */ | |
| 94 | + ListenableFuture<Session> initAsync(); | |
| 86 | 95 | |
| 87 | 96 | /** |
| 88 | 97 | * Executes the provided query. |
| @@ -101,7 +110,7 @@ | ||
| 101 | 110 | * @throws QueryValidationException if the query if invalid (syntax error, |
| 102 | 111 | * unauthorized or any other validation problem). |
| 103 | 112 | */ |
| 104 | - public ResultSet execute(String query); | |
| 113 | + ResultSet execute(String query); | |
| 105 | 114 | |
| 106 | 115 | /** |
| 107 | 116 | * Executes the provided query using the provided value. |
| @@ -125,7 +134,7 @@ | ||
| 125 | 134 | * is in use (i.e. if you've force version 1 through {@link Cluster.Builder#withProtocolVersion} |
| 126 | 135 | * or you use Cassandra 1.2). |
| 127 | 136 | */ |
| 128 | - public ResultSet execute(String query, Object... values); | |
| 137 | + ResultSet execute(String query, Object... values); | |
| 129 | 138 | |
| 130 | 139 | /** |
| 131 | 140 | * Executes the provided query. |
| @@ -153,7 +162,7 @@ | ||
| 153 | 162 | * the version protocol 1 include: BatchStatement, ResultSet paging and binary |
| 154 | 163 | * values in RegularStatement. |
| 155 | 164 | */ |
| 156 | - public ResultSet execute(Statement statement); | |
| 165 | + ResultSet execute(Statement statement); | |
| 157 | 166 | |
| 158 | 167 | /** |
| 159 | 168 | * Executes the provided query asynchronously. |
| @@ -163,7 +172,7 @@ | ||
| 163 | 172 | * @param query the CQL query to execute. |
| 164 | 173 | * @return a future on the result of the query. |
| 165 | 174 | */ |
| 166 | - public ResultSetFuture executeAsync(String query); | |
| 175 | + ResultSetFuture executeAsync(String query); | |
| 167 | 176 | |
| 168 | 177 | /** |
| 169 | 178 | * Executes the provided query asynchronously using the provided values. |
| @@ -179,7 +188,7 @@ | ||
| 179 | 188 | * is in use (i.e. if you've force version 1 through {@link Cluster.Builder#withProtocolVersion} |
| 180 | 189 | * or you use Cassandra 1.2). |
| 181 | 190 | */ |
| 182 | - public ResultSetFuture executeAsync(String query, Object... values); | |
| 191 | + ResultSetFuture executeAsync(String query, Object... values); | |
| 183 | 192 | |
| 184 | 193 | /** |
| 185 | 194 | * Builds, but does not execute, a simple statement containing the provided query. |
| @@ -191,7 +200,7 @@ | ||
| 191 | 200 | * @param query the CQL query to execute. |
| 192 | 201 | * @return the simple statement. |
| 193 | 202 | */ |
| 194 | - public SimpleStatement newSimpleStatement(String query); | |
| 203 | + SimpleStatement newSimpleStatement(String query); | |
| 195 | 204 | |
| 196 | 205 | /** |
| 197 | 206 | * Builds, but does not execute, a simple statement containing the provided query with |
| @@ -241,7 +250,7 @@ | ||
| 241 | 250 | * @param values values required for the execution of {@code query}. |
| 242 | 251 | * @return the simple statement. |
| 243 | 252 | */ |
| 244 | - public SimpleStatement newSimpleStatement(String query, Object... values); | |
| 253 | + SimpleStatement newSimpleStatement(String query, Object... values); | |
| 245 | 254 | |
| 246 | 255 | /** |
| 247 | 256 | * Executes the provided query asynchronously. |
| @@ -264,7 +273,7 @@ | ||
| 264 | 273 | * the version protocol 1 include: BatchStatement, ResultSet paging and binary |
| 265 | 274 | * values in RegularStatement. |
| 266 | 275 | */ |
| 267 | - public ResultSetFuture executeAsync(Statement statement); | |
| 276 | + ResultSetFuture executeAsync(Statement statement); | |
| 268 | 277 | |
| 269 | 278 | /** |
| 270 | 279 | * Prepares the provided query string. |
| @@ -275,7 +284,7 @@ | ||
| 275 | 284 | * @throws NoHostAvailableException if no host in the cluster can be |
| 276 | 285 | * contacted successfully to prepare this query. |
| 277 | 286 | */ |
| 278 | - public PreparedStatement prepare(String query); | |
| 287 | + PreparedStatement prepare(String query); | |
| 279 | 288 | |
| 280 | 289 | /** |
| 281 | 290 | * Prepares the provided query. |
| @@ -305,7 +314,7 @@ | ||
| 305 | 314 | * though the {@link PreparedStatement#bind} method or through a corresponding |
| 306 | 315 | * {@link BoundStatement}). |
| 307 | 316 | */ |
| 308 | - public PreparedStatement prepare(RegularStatement statement); | |
| 317 | + PreparedStatement prepare(RegularStatement statement); | |
| 309 | 318 | |
| 310 | 319 | /** |
| 311 | 320 | * Prepares the provided query string asynchronously. |
| @@ -317,7 +326,7 @@ | ||
| 317 | 326 | * @param query the CQL query string to prepare |
| 318 | 327 | * @return a future on the prepared statement corresponding to {@code query}. |
| 319 | 328 | */ |
| 320 | - public ListenableFuture<PreparedStatement> prepareAsync(String query); | |
| 329 | + ListenableFuture<PreparedStatement> prepareAsync(String query); | |
| 321 | 330 | |
| 322 | 331 | /** |
| 323 | 332 | * Prepares the provided query asynchronously. |
| @@ -346,7 +355,7 @@ | ||
| 346 | 355 | * though the {@link PreparedStatement#bind} method or through a corresponding |
| 347 | 356 | * {@link BoundStatement}). |
| 348 | 357 | */ |
| 349 | - public ListenableFuture<PreparedStatement> prepareAsync(RegularStatement statement); | |
| 358 | + ListenableFuture<PreparedStatement> prepareAsync(RegularStatement statement); | |
| 350 | 359 | |
| 351 | 360 | /** |
| 352 | 361 | * Initiates a shutdown of this session instance. |
| @@ -372,7 +381,7 @@ | ||
| 372 | 381 | * |
| 373 | 382 | * @return a future on the completion of the shutdown process. |
| 374 | 383 | */ |
| 375 | - public CloseFuture closeAsync(); | |
| 384 | + CloseFuture closeAsync(); | |
| 376 | 385 | |
| 377 | 386 | /** |
| 378 | 387 | * Initiates a shutdown of this session instance and blocks until |
| @@ -387,7 +396,7 @@ | ||
| 387 | 396 | * If you want to do so, use {@link Cluster#close}, but note that it will |
| 388 | 397 | * close all sessions created from that cluster. |
| 389 | 398 | */ |
| 390 | - public void close(); | |
| 399 | + void close(); | |
| 391 | 400 | |
| 392 | 401 | /** |
| 393 | 402 | * Whether this Session instance has been closed. |
| @@ -401,14 +410,14 @@ | ||
| 401 | 410 | * @return {@code true} if this Session instance has been closed, {@code false} |
| 402 | 411 | * otherwise. |
| 403 | 412 | */ |
| 404 | - public boolean isClosed(); | |
| 413 | + boolean isClosed(); | |
| 405 | 414 | |
| 406 | 415 | /** |
| 407 | 416 | * Returns the {@code Cluster} object this session is part of. |
| 408 | 417 | * |
| 409 | 418 | * @return the {@code Cluster} object this session is part of. |
| 410 | 419 | */ |
| 411 | - public Cluster getCluster(); | |
| 420 | + Cluster getCluster(); | |
| 412 | 421 | |
| 413 | 422 | /** |
| 414 | 423 | * Return a snapshot of the state of this Session. |
| @@ -420,7 +429,7 @@ | ||
| 420 | 429 | * |
| 421 | 430 | * @return a snapshot of the state of this Session. |
| 422 | 431 | */ |
| 423 | - public State getState(); | |
| 432 | + State getState(); | |
| 424 | 433 | |
| 425 | 434 | /** |
| 426 | 435 | * The state of a Session. |
| @@ -428,13 +437,13 @@ | ||
| 428 | 437 | * This mostly exposes information on the connections maintained by a Session: |
| 429 | 438 | * which host it is connected to, how many connection is has for each host, etc... |
| 430 | 439 | */ |
| 431 | - public interface State { | |
| 440 | + interface State { | |
| 432 | 441 | /** |
| 433 | 442 | * The Session to which this State corresponds to. |
| 434 | 443 | * |
| 435 | 444 | * @return the Session to which this State corresponds to. |
| 436 | 445 | */ |
| 437 | - public Session getSession(); | |
| 446 | + Session getSession(); | |
| 438 | 447 | |
| 439 | 448 | /** |
| 440 | 449 | * The hosts to which the session is currently connected (more precisely, at the time |
| @@ -447,7 +456,7 @@ | ||
| 447 | 456 | * |
| 448 | 457 | * @return an immutable collection of the hosts to which the session is connected. |
| 449 | 458 | */ |
| 450 | - public Collection<Host> getConnectedHosts(); | |
| 459 | + Collection<Host> getConnectedHosts(); | |
| 451 | 460 | |
| 452 | 461 | /** |
| 453 | 462 | * The number of open connections to a given host. |
| @@ -459,7 +468,7 @@ | ||
| 459 | 468 | * @return The number of open connections to {@code host}. If the session |
| 460 | 469 | * is not connected to that host, 0 is returned. |
| 461 | 470 | */ |
| 462 | - public int getOpenConnections(Host host); | |
| 471 | + int getOpenConnections(Host host); | |
| 463 | 472 | |
| 464 | 473 | /** |
| 465 | 474 | * The number of "trashed" connections to a given host. |
| @@ -473,7 +482,7 @@ | ||
| 473 | 482 | * @return The number of trashed connections to {@code host}. If the session |
| 474 | 483 | * is not connected to that host, 0 is returned. |
| 475 | 484 | */ |
| 476 | - public int getTrashedConnections(Host host); | |
| 485 | + int getTrashedConnections(Host host); | |
| 477 | 486 | |
| 478 | 487 | /** |
| 479 | 488 | * The number of queries that are currently being executed though a given host. |
| @@ -487,6 +496,6 @@ | ||
| 487 | 496 | * @return the number of currently (as in 'at the time the state was grabbed') executing |
| 488 | 497 | * queries to {@code host}. |
| 489 | 498 | */ |
| 490 | - public int getInFlightQueries(Host host); | |
| 499 | + int getInFlightQueries(Host host); | |
| 491 | 500 | } |
| 492 | 501 | } |
modified upgrade_guide/README.md +4 −0
| @@ -197,6 +197,10 @@ | ||
| 197 | 197 | they match the schema, in anticipation for the schema generation features |
| 198 | 198 | that will be added in a future version. |
| 199 | 199 | |
| 200 | +18. `AsyncInitSession` has been removed, `initAsync()` is now part of the | |
| 201 | + `Session` interface (the only purpose of the extra interface was to preserve | |
| 202 | + binary compatibility on the 2.1 branch). | |
| 203 | + | |
| 200 | 204 | |
| 201 | 205 | ### 2.1.7 |
| 202 | 206 |