jorgeortiz85 / init-deadlock

Demo of static init deadlock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This project demonstrates a deadlock between threads initializing singleton objects that have a circular dependency between them. If the objects are initialized in parallel by different threads, they will deadlock. If the objects are initialized serially, no deadlock occurs.

To run this project, run sbt and type:

run-main ScalaTest parallel to run the Scala test in parallel

run-main ScalaTest serial to run the Scala test in series

run-main JavaTest to run the Java test (only runs in parallel)

Suggestions on how to catch this class of errors (at compile time, test time, or run time) are most welcome.

About

Demo of static init deadlock


Languages

Language:Scala 62.8%Language:Java 37.2%