public class ChocolateBoiler {
    private static boolean empty;
    private static boolean boiled;
    private static ChocolateBoiler uniqueInstance;

    private ChocolateBoiler() {
        empty = true;
        boiled = false;
    }

    public static ChocolateBoiler getInstance() {
        if (uniqueInstance == null) {
            uniqueInstance = new ChocolateBoiler();
        }

        return uniqueInstance;
    }

    public void fill() {
        if (isEmpty()) {
            empty = false;
            boiled = false;
        }
    }

    public void drain() {
        if (!isEmpty() && isBoiled()) {
            empty = true;
        }
    }

    public void boil() {
        if (!isEmpty() && !isBoiled()) {
            boiled = true;
        }
    }

    public boolean isEmpty() {
        return empty;
    }

    public boolean isBoiled() {
        return boiled;
    }
}

@@ -101,24 +101,33 @@
     private 
+volatile 
 static Choco
@@ -301,38 +301,340 @@
     
-if (uniqueInstance == null) %7B%0A
+// Ensure synchonization (read: code block locking) only occurs upon lazy loading of this class.%0A        // We do this becasue synchronization is expensive, especially when multithreading.%0A        if (uniqueInstance == null) %7B%0A            synchronized (ChocolateBoiler.class) %7B%0A                if (uniqueInstance == null) %7B%0A        
     
@@ -681,16 +681,48 @@
 iler();%0A
+                %7D%0A            %7D%0A
         

add thread safety