SLH-8110 The Java developers' guide to asynchronous programming | Devoxx

The Java developers' guide to asynchronous programming

Conference

java Java, JVM, Java SE/EE Click here to save this talk in your agenda

Room 2

Thursday at 14:30 - 15:20

Blocking/synchronous programming has been the norm in Java. However this programming model has a major limitation: it requires one thread per concurrent request. This means that the number of requests you can process concurrently cannot exceed the number of threads, which limits scaling. This talk will explore how an asynchronous programming model can be used to avoid this limitation.

After an introduction to asynchronous design, there will be a live coding session where we will build an example service that makes concurrent calls.

We will cover the following tools:

  • The Java Future
  • New in Java 8: The CompletableFuture
  • RxJava Observables
  • The async Servlet, Spring and JAX-RS APIs
  • The Ratpack Promise

The see the following patterns:

  • Merging multiple calls into a single result
  • Returning a result when a subset of multiple calls return without blocking waiting for the rest (e.g. saving an audit log without blocking the user request)
  • Executing multiple calls and creating a result from the one that returns first

By the end of the session you should be aware of the popular tools you have for non-blocking programming in Java and when and why you should use them.

Christopher Batey Christopher Batey

Christopher (@chbatey) is a freelance software engineer. He is currently working as a Principal Software Engineer at Sky on a large project that is making use of non-blocking tools and frameworks within containers to vastly reduce the number of servers required to service millions of users. Likes: Scala, Java, the JVM, Akka, distributed databases, XP, TDD, Pairing. Hates: Untested software, code ownership. You can checkout his blog at: http://christopher-batey.blogspot.co.uk/.