IntelliJ IDEA 2017.1 EAP Extends Debugger with Async Stack Traces
Reactive programming allows us to build efficient applications, but these applications are very difficult to write and debug. IntelliJ IDEA's new
Join the DZone community and get the full member experience.Join For Free
Following the reactive programming trend, our code is getting more asynchronous. Earlier, Java 8 introduced CompletableFuture (adopted from Guava’s ListenableFuture). Akka, Ratpack, Reactor, RxJava, Vert.x, and other libraries implement Reactive Streams, Scala offers Future, Kotlin is adding Coroutines, and finally, Java 9 is about to bring us the Flow. Well, reactive programming helps us build efficient applications, but boy, are they difficult to write and debug.
Consider this sample (courtesy of Tomasz Nurkiewicz):
If we put a breakpoint here, the stack trace will look somewhat like this:
Instead of the place where we invoke
S2_Creating.supplyAsync), we’re looking at
ForkJoinPool.runWorker (an executor service that runs code asynchronously) and all of its internals. This makes it harder to understand the data flow and also makes it almost impossible to navigate to relevant frames.
Published at DZone with permission of Andrey Cheptsov, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.