Last Updated: February 25, 2016
· davetron5000

Threads in Ruby? Use JRuby

Threads are an easy way to run background processes or do things concurrently, but the management of threads and shared state can be difficult.

Use JRuby and the java.util.concurrent package. The javadoc is amazing:


And with JRuby, you can write idiomatic Ruby code that uses all the power provided by the JVM for managing threads and dealing with shared state.