email iconemail phone iconcall

Introducing Java driver 4

By Olivier Michallat -  August 1, 2017 | 0 Comments

Today we are releasing Java driver 4.0.0-alpha1, the first preview of our next major version.

Those of you familiar with semantic versioning will notice that this version number indicates breaking API changes; we felt that this was needed to address a number of longstanding issues:

  • Java 8 support: we dropped support for JDK 6 and 7. This allows us to use Java 8 futures in the API, and take advantage of the latest language features like try-with-resources blocks and lambda expressions.
  • No more dependency to Guava: this has been a recurring pain point with earlier versions. We're happy to announce that the driver does not depend on Guava anymore (it's still used internally, but shaded).
  • Separation of packages into API / internal categories; this allows us to expose more hooks for advanced customization. For example, one thing you can do is override the driver's node discovery mechanism.
  • New configuration API with a default implementation based on Typesafe Config.
  • Immutable statement types to eliminate thread safety issues.
  • Pluggable request execution logic. We plan to use that to provide a reactive extension in the near future.

For full details, please refer to the upgrade guide.

Despite all those changes, the main API should still look familiar to 3.x users. For example, here is the canonical connection example:

try (Cluster cluster =
    Cluster.builder().addContactPoint(new InetSocketAddress("127.0.0.1", 9042)).build()) {

  Session session = cluster.connect();

  ResultSet rs = session.execute("select release_version from system.local");
  Row row = rs.iterator().next();
  System.out.println(row.getString("release_version"));
}

The driver is available from Maven central (note that the coordinates have changed):

<dependency>
  <groupId>com.datastax.oss</groupId>
  <artifactId>java-driver-parent</artifactId>
  <version>4.0.0-alpha1</version>
</dependency>

The sources are on the 4.x branch on GitHub.

Next steps

This alpha release is an early preview for evaluation by bleeding edge adopters. It has not been fully tested and is not production-ready. The basic request execution logic is functional, but many features are still missing, notably: schema and token metadata, metrics, the query builder, non-default policy implementations, compression.

We'll keep working towards a feature-complete beta in the upcoming months. Look for JIRA tickets with 4.* fix versions for an overview of upcoming tasks (here's a filter for 4.0.0-alpha2 and GA).

In the meantime, you can try the new API and provide feedback on the mailing list, or even pick a ticket and create a pull request (please discuss it with us beforehand, as some tickets may require additional information).









DataStax has many ways for you to advance in your career and knowledge.

You can take free classes, get certified, or read one of our many white papers.



register for classes

get certified

DBA's Guide to NoSQL







Comments

Your email address will not be published. Required fields are marked *




Subscribe for newsletter: