kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | da8137a35958d2352028a84f03f4ff489be04ebd4c1ef4b1d840a09692ae3571 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-10-09 12:12 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-10-09 12:13 +02:00 |
| Parents | d9f56f5d0e64 |
12 files changed
added clirr-ignores.xml +64 −0
| @@ -0,0 +1,64 @@ | ||
| 1 | +<!-- | |
| 2 | + Clirr is a tool that checks Java libraries for binary and source compatibility with older releases. | |
| 3 | + | |
| 4 | + This file lists known (and accepted) differences with the reference version specified in pom.xml. | |
| 5 | + | |
| 6 | + To update this file: | |
| 7 | + * run `mvn clirr:clirr` at the root directory | |
| 8 | + * check the reports in `<module>/target/site/clirr-report.html` | |
| 9 | + * add new differences if needed. Difference types are explained at http://mojo.codehaus.org/clirr-maven-plugin/examples/ignored-differences.html | |
| 10 | +--> | |
| 11 | +<differences> | |
| 12 | + <difference> | |
| 13 | + <differenceType>7006</differenceType> <!-- return type changed --> | |
| 14 | + <className>com/datastax/driver/core/BatchStatement</className> | |
| 15 | + <method>com.datastax.driver.core.Statement setSerialConsistencyLevel(com.datastax.driver.core.ConsistencyLevel)</method> | |
| 16 | + <to>com.datastax.driver.core.BatchStatement</to> | |
| 17 | + <justification>A covariant return makes the API more fluent. It's unlikely that any client has extended this class</justification> | |
| 18 | + </difference> | |
| 19 | + | |
| 20 | + <difference> | |
| 21 | + <differenceType>6002</differenceType> <!-- no longer a compile-time constant --> | |
| 22 | + <className>com/datastax/driver/core/ProtocolOptions</className> | |
| 23 | + <field>NEWEST_SUPPORTED_PROTOCOL_VERSION</field> | |
| 24 | + <justification>It calls an enum's method that is known to have a constant result</justification> | |
| 25 | + </difference> | |
| 26 | + | |
| 27 | + <difference> | |
| 28 | + <differenceType>7004</differenceType> <!-- argument count changed --> | |
| 29 | + <className>com/datastax/driver/core/exceptions/UnsupportedFeatureException</className> | |
| 30 | + <method>UnsupportedFeatureException(java.lang.String)</method> | |
| 31 | + <justification>A client has no reason to call this constructor</justification> | |
| 32 | + </difference> | |
| 33 | + | |
| 34 | + <difference> | |
| 35 | + <differenceType>7012</differenceType> <!-- method added to interface --> | |
| 36 | + <className>com/datastax/driver/core/ResultSet</className> | |
| 37 | + <method>boolean wasApplied()</method> | |
| 38 | + <justification>This interface is not meant to be extended by clients</justification> | |
| 39 | + </difference> | |
| 40 | + | |
| 41 | + <difference> | |
| 42 | + <differenceType>7013</differenceType> <!-- abstract method added --> | |
| 43 | + <className>com/datastax/driver/core/RegularStatement</className> | |
| 44 | + <method>java.nio.ByteBuffer[] getValues(com.datastax.driver.core.ProtocolVersion)</method> | |
| 45 | + <justification>Indeed a breaking change, but extending this class from a client should be rarely needed</justification> | |
| 46 | + </difference> | |
| 47 | + | |
| 48 | + <difference> | |
| 49 | + <differenceType>7005</differenceType> <!-- argument type changed --> | |
| 50 | + <className>com/datastax/driver/core/SimpleStatement</className> | |
| 51 | + <method>java.nio.ByteBuffer[] getValues(int)</method> | |
| 52 | + <to>java.nio.ByteBuffer[] getValues(com.datastax.driver.core.ProtocolVersion)</to> | |
| 53 | + <justification>A backward compatible version has been added to the parent class RegularStatement</justification> | |
| 54 | + </difference> | |
| 55 | + | |
| 56 | + <difference> | |
| 57 | + <differenceType>7005</differenceType> <!-- argument type changed --> | |
| 58 | + <className>com/datastax/driver/core/querybuilder/*</className> | |
| 59 | + <method>java.nio.ByteBuffer[] getValues(int)</method> | |
| 60 | + <to>java.nio.ByteBuffer[] getValues(com.datastax.driver.core.ProtocolVersion)</to> | |
| 61 | + <justification>A backward compatible version has been added to the parent class RegularStatement</justification> | |
| 62 | + </difference> | |
| 63 | + | |
| 64 | +</differences> |
modified driver-core/src/main/java/com/datastax/driver/core/AbstractGettableData.java +10 −0
| @@ -37,6 +37,16 @@ | ||
| 37 | 37 | super(protocolVersion); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + /** | |
| 41 | + * @throws IllegalArgumentException if {@code protocolVersion} does not correspond to any known version. | |
| 42 | + * | |
| 43 | + * @deprecated This constructor is provided for backward compatibility, use {@link #AbstractGettableData(ProtocolVersion)} instead. | |
| 44 | + */ | |
| 45 | + @Deprecated | |
| 46 | + protected AbstractGettableData(int protocolVersion) { | |
| 47 | + this(ProtocolVersion.fromInt(protocolVersion)); | |
| 48 | + } | |
| 49 | + | |
| 40 | 50 | /** |
| 41 | 51 | * Returns the index corresponding to a given name. |
| 42 | 52 | * |
modified driver-core/src/main/java/com/datastax/driver/core/ProtocolOptions.java +32 −1
| @@ -62,6 +62,14 @@ | ||
| 62 | 62 | */ |
| 63 | 63 | public static final int DEFAULT_PORT = 9042; |
| 64 | 64 | |
| 65 | + /** | |
| 66 | + * The newest version of the protocol that this version of the driver support. | |
| 67 | + * | |
| 68 | + * @deprecated This is provided for backward compatibility; use {@link ProtocolVersion#NEWEST_SUPPORTED} instead. | |
| 69 | + */ | |
| 70 | + @Deprecated | |
| 71 | + public static final int NEWEST_SUPPORTED_PROTOCOL_VERSION = ProtocolVersion.NEWEST_SUPPORTED.toInt(); | |
| 72 | + | |
| 65 | 73 | private volatile Cluster.Manager manager; |
| 66 | 74 | |
| 67 | 75 | private final int port; |
| @@ -112,6 +120,19 @@ | ||
| 112 | 120 | this.authProvider = authProvider; |
| 113 | 121 | } |
| 114 | 122 | |
| 123 | + /** | |
| 124 | + * @throws IllegalArgumentException if {@code protocolVersion} does not correspond to any known version. | |
| 125 | + * | |
| 126 | + * @deprecated This is provided for backward compatibility; use {@link #ProtocolOptions(int, ProtocolVersion, SSLOptions, AuthProvider))} instead. | |
| 127 | + */ | |
| 128 | + @Deprecated | |
| 129 | + public ProtocolOptions(int port, int protocolVersion, SSLOptions sslOptions, AuthProvider authProvider) { | |
| 130 | + this.port = port; | |
| 131 | + this.initialProtocolVersion = ProtocolVersion.fromInt(protocolVersion); | |
| 132 | + this.sslOptions = sslOptions; | |
| 133 | + this.authProvider = authProvider; | |
| 134 | + } | |
| 135 | + | |
| 115 | 136 | void register(Cluster.Manager manager) { |
| 116 | 137 | this.manager = manager; |
| 117 | 138 | } |
| @@ -134,10 +155,20 @@ | ||
| 134 | 155 | * Cluster instance is connected, this is guaranteed to return a non-null value). Note that |
| 135 | 156 | * nodes that do not support this protocol version will be ignored. |
| 136 | 157 | */ |
| 137 | - public ProtocolVersion getProtocolVersion() { | |
| 158 | + public ProtocolVersion getProtocolVersionEnum() { | |
| 138 | 159 | return manager.connectionFactory.protocolVersion; |
| 139 | 160 | } |
| 140 | 161 | |
| 162 | + /** | |
| 163 | + * The protocol version used by the Cluster instance, as a number. | |
| 164 | + * | |
| 165 | + * @deprecated This is provided for backward compatibility, use {@link #getProtocolVersionEnum()} instead. | |
| 166 | + */ | |
| 167 | + @Deprecated | |
| 168 | + public int getProtocolVersion() { | |
| 169 | + return getProtocolVersionEnum().toInt(); | |
| 170 | + } | |
| 171 | + | |
| 141 | 172 | /** |
| 142 | 173 | * Returns the compression used by the protocol. |
| 143 | 174 | * <p> |
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +4 −4
| @@ -133,7 +133,7 @@ | ||
| 133 | 133 | switch (rm.kind) { |
| 134 | 134 | case PREPARED: |
| 135 | 135 | Responses.Result.Prepared pmsg = (Responses.Result.Prepared)rm; |
| 136 | - PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster.getMetadata(), cluster.getConfiguration().getProtocolOptions().getProtocolVersion(), query, poolsState.keyspace); | |
| 136 | + PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster.getMetadata(), cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum(), query, poolsState.keyspace); | |
| 137 | 137 | stmt = cluster.manager.addPrepared(stmt); |
| 138 | 138 | try { |
| 139 | 139 | // All Sessions are connected to the same nodes so it's enough to prepare only the nodes of this session. |
| @@ -197,7 +197,7 @@ | ||
| 197 | 197 | return true; |
| 198 | 198 | |
| 199 | 199 | HostConnectionPool newPool = HostConnectionPool.newInstance(host, distance, SessionManager.this, |
| 200 | - cluster.getConfiguration().getProtocolOptions().getProtocolVersion()); | |
| 200 | + cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum()); | |
| 201 | 201 | HostConnectionPool previous = pools.put(host, newPool); |
| 202 | 202 | if (previous == null) { |
| 203 | 203 | logger.debug("Added connection pool for {}", host); |
| @@ -237,7 +237,7 @@ | ||
| 237 | 237 | return false; |
| 238 | 238 | |
| 239 | 239 | HostConnectionPool newPool = HostConnectionPool.newInstance(host, distance, SessionManager.this, |
| 240 | - cluster.getConfiguration().getProtocolOptions().getProtocolVersion()); | |
| 240 | + cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum()); | |
| 241 | 241 | pools.put(host, newPool); |
| 242 | 242 | |
| 243 | 243 | // If we raced with a session shutdown, ensure that the pool will be closed. |
| @@ -493,7 +493,7 @@ | ||
| 493 | 493 | if (statement.isTracing()) |
| 494 | 494 | msg.setTracingRequested(); |
| 495 | 495 | |
| 496 | - DefaultResultSetFuture future = new DefaultResultSetFuture(this, configuration().getProtocolOptions().getProtocolVersion(), msg); | |
| 496 | + DefaultResultSetFuture future = new DefaultResultSetFuture(this, configuration().getProtocolOptions().getProtocolVersionEnum(), msg); | |
| 497 | 497 | execute(future, statement); |
| 498 | 498 | return future; |
| 499 | 499 | } |
modified driver-core/src/main/java/com/datastax/driver/core/policies/Policies.java +20 −0
| @@ -52,6 +52,26 @@ | ||
| 52 | 52 | this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, DEFAULT_ADDRESS_TRANSLATER, defaultTimestampGenerator()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** | |
| 56 | + * Creates a new {@code Policies} object using the provided policies. | |
| 57 | + * | |
| 58 | + * @param loadBalancingPolicy the load balancing policy to use. | |
| 59 | + * @param reconnectionPolicy the reconnection policy to use. | |
| 60 | + * @param retryPolicy the retry policy to use. | |
| 61 | + * @param addressTranslater the address translater to use. | |
| 62 | + */ | |
| 63 | + public Policies(LoadBalancingPolicy loadBalancingPolicy, | |
| 64 | + ReconnectionPolicy reconnectionPolicy, | |
| 65 | + RetryPolicy retryPolicy, | |
| 66 | + AddressTranslater addressTranslater) { | |
| 67 | + // NB: this constructor is provided for backward compatibility with 2.1.0 | |
| 68 | + this.loadBalancingPolicy = loadBalancingPolicy; | |
| 69 | + this.reconnectionPolicy = reconnectionPolicy; | |
| 70 | + this.retryPolicy = retryPolicy; | |
| 71 | + this.addressTranslater = addressTranslater; | |
| 72 | + this.timestampGenerator = defaultTimestampGenerator(); | |
| 73 | + } | |
| 74 | + | |
| 55 | 75 | /** |
| 56 | 76 | * Creates a new {@code Policies} object using the provided policies. |
| 57 | 77 | * |
modified driver-core/src/test/java/com/datastax/driver/core/BatchStatementTest.java +2 −2
| @@ -71,7 +71,7 @@ | ||
| 71 | 71 | |
| 72 | 72 | } catch (UnsupportedFeatureException e) { |
| 73 | 73 | // This is expected when testing the protocol v1 |
| 74 | - if (cluster.getConfiguration().getProtocolOptions().getProtocolVersion() != ProtocolVersion.V1) | |
| 74 | + if (cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum() != ProtocolVersion.V1) | |
| 75 | 75 | throw e; |
| 76 | 76 | } catch (Throwable t) { |
| 77 | 77 | errorOut(); |
| @@ -106,7 +106,7 @@ | ||
| 106 | 106 | |
| 107 | 107 | } catch (UnsupportedFeatureException e) { |
| 108 | 108 | // This is expected when testing the protocol v1 |
| 109 | - if (cluster.getConfiguration().getProtocolOptions().getProtocolVersion() != ProtocolVersion.V1) | |
| 109 | + if (cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum() != ProtocolVersion.V1) | |
| 110 | 110 | throw e; |
| 111 | 111 | } catch (Throwable t) { |
| 112 | 112 | errorOut(); |
modified driver-core/src/test/java/com/datastax/driver/core/FetchingTest.java +1 −1
| @@ -61,7 +61,7 @@ | ||
| 61 | 61 | |
| 62 | 62 | } catch (UnsupportedFeatureException e) { |
| 63 | 63 | // This is expected when testing the protocol v1 |
| 64 | - if (cluster.getConfiguration().getProtocolOptions().getProtocolVersion() != ProtocolVersion.V1) | |
| 64 | + if (cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum() != ProtocolVersion.V1) | |
| 65 | 65 | throw e; |
| 66 | 66 | } catch (Throwable e) { |
| 67 | 67 | errorOut(); |
modified driver-core/src/test/java/com/datastax/driver/core/PreparedStatementTest.java +1 −1
| @@ -407,7 +407,7 @@ | ||
| 407 | 407 | assertEquals("bar", all.get(2).getString("v")); |
| 408 | 408 | } catch (UnsupportedFeatureException e) { |
| 409 | 409 | // This is expected when testing the protocol v1 |
| 410 | - if (cluster.getConfiguration().getProtocolOptions().getProtocolVersion() != ProtocolVersion.V1) | |
| 410 | + if (cluster.getConfiguration().getProtocolOptions().getProtocolVersionEnum() != ProtocolVersion.V1) | |
| 411 | 411 | throw e; |
| 412 | 412 | } |
| 413 | 413 | } |
modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +1 −1
| @@ -372,7 +372,7 @@ | ||
| 372 | 372 | |
| 373 | 373 | public static int numberOfLocalCoreConnections(Cluster cluster) { |
| 374 | 374 | Configuration configuration = cluster.getConfiguration(); |
| 375 | - ProtocolVersion protocolVersion = configuration.getProtocolOptions().getProtocolVersion(); | |
| 375 | + ProtocolVersion protocolVersion = configuration.getProtocolOptions().getProtocolVersionEnum(); | |
| 376 | 376 | return (protocolVersion.compareTo(ProtocolVersion.V3) < 0) |
| 377 | 377 | ? configuration.getPoolingOptions().getCoreConnectionsPerHost(HostDistance.LOCAL) |
| 378 | 378 | : 1; |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +1 −1
| @@ -61,7 +61,7 @@ | ||
| 61 | 61 | KeyspaceMetadata keyspace = session().getCluster().getMetadata().getKeyspace(mapper.getKeyspace()); |
| 62 | 62 | this.tableMetadata = keyspace == null ? null : keyspace.getTable(Metadata.quote(mapper.getTable())); |
| 63 | 63 | |
| 64 | - this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersion(); | |
| 64 | + this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum(); | |
| 65 | 65 | this.mapOneFunction = new Function<ResultSet, T>() { |
| 66 | 66 | public T apply(ResultSet rs) { |
| 67 | 67 | return Mapper.this.map(rs).one(); |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/MethodMapper.java +1 −1
| @@ -123,7 +123,7 @@ | ||
| 123 | 123 | |
| 124 | 124 | BoundStatement bs = statement.bind(); |
| 125 | 125 | |
| 126 | - ProtocolVersion protocolVersion = session.getCluster().getConfiguration().getProtocolOptions().getProtocolVersion(); | |
| 126 | + ProtocolVersion protocolVersion = session.getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum(); | |
| 127 | 127 | for (int i = 0; i < args.length; i++) { |
| 128 | 128 | paramMappers[i].setValue(bs, args[i], protocolVersion); |
| 129 | 129 | } |
modified pom.xml +17 −0
| @@ -108,6 +108,23 @@ | ||
| 108 | 108 | <tagNameFormat>@{project.version}</tagNameFormat> |
| 109 | 109 | </configuration> |
| 110 | 110 | </plugin> |
| 111 | + <plugin> | |
| 112 | + <groupId>org.codehaus.mojo</groupId> | |
| 113 | + <artifactId>clirr-maven-plugin</artifactId> | |
| 114 | + <version>2.6.1</version> | |
| 115 | + <configuration> | |
| 116 | + <comparisonVersion>2.1.0</comparisonVersion> | |
| 117 | + <ignoredDifferencesFile>../clirr-ignores.xml</ignoredDifferencesFile> | |
| 118 | + <excludes> | |
| 119 | + <!-- Package-private, internal classes --> | |
| 120 | + <exclude>com/datastax/driver/core/Frame$*</exclude> | |
| 121 | + <exclude>com/datastax/driver/core/ProtocolEvent$*</exclude> | |
| 122 | + <exclude>com/datastax/driver/core/Message$*</exclude> | |
| 123 | + <exclude>com/datastax/driver/core/Requests$*</exclude> | |
| 124 | + <exclude>com/datastax/driver/core/Responses$*</exclude> | |
| 125 | + </excludes> | |
| 126 | + </configuration> | |
| 127 | + </plugin> | |
| 111 | 128 | </plugins> |
| 112 | 129 | </build> |
| 113 | 130 |