code snippets inspired by reading the "Java Concurrency in Practice" book by Brian Goetz