package Samples; /*Generated by MPS */ public final class DropBox<T> { private T storage; public DropBox() { // Use Alt+Enter on the class name to mark it as thread-safe or non-thread-safe // The see the effect it has on the error/warning reporting in the ThreadSafeSample class } public synchronized void store(T value) throws InterruptedException { while (storage != null) { this.wait(); } storage = value; this.notify(); } public synchronized T retrieve() throws InterruptedException { while (storage == null) { this.wait(); } T pom = storage; storage = null; this.notify(); return pom; } }