Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Deadlocks - Part II

import java.util.concurrent.atomic.AtomicInteger;
class DeepThoughtTask implements Runnable {
static AtomicInteger finalResult = new AtomicInteger(0);
private int computeResult() {
return 1; // assume this is a long-running task
public void run() {
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content