Refactoring for Concurrency

Workshop Host: Tim Myer

Software & Installation Pre-requisites:

Participants are encouraged to have the following installed as a pre-requisite:

  1. A git client (to get the source)
  2. Java 8
  3. A Java editor / IDE (Eclipse, IntelliJ, Netbeans,
  4. Gradle.


A walk through various scenarios in a codebase that works perfectly when there are only a few users in the system, but where subtle, irreproducible or hard-to-reproduce bugs appear under load. S let’s explore what makes this code concurrency-unsafe and what options we have for changing the implementation of the code without changing its expected behavior.

These are the scenarios to explore:

  1. One-time component initialization
  2. Stateful singletons
  3. Undocumented third-party libraries
  4. Switching from blocking to non-blocking collections
  5. Protecting critical regions of code
  6. Distributed atomic operations

Learning Objectives:

  1. Can I safely make changes that will not break existing features?
  2. How much testing will give me confidence that the code works under load?
  3. At what layer (unit, integration, acceptance, other???) should I test?

Code examples will be primarily in Java, but we might explore libraries and features of other relevant languages. This will be a hands-on workshop. All code will be in github.