@@ -0,0 +1,805 @@
+/**%0A * %0A */%0Apackage com.trendrr.oss.concurrent;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A%0A%0A/**%0A * Provides a safe way to wait on a value to be set.%0A * %0A * from the guava wiki.%0A * %0A * The box holds exactly one value at a time%0A * %0A * %0A * %0A * @author Dustin Norlander%0A * @created May 23, 2012%0A * %0A */%0Apublic class SafeBox%3CV%3E %7B%0A%0A%09protected static Log log = LogFactory.getLog(SafeBox.class);%0A%09private V value = null;%0A%09%0A%09public synchronized V getAndClear() throws InterruptedException %7B%0A%09  while (value == null) %7B%0A%09    wait();%0A%09  %7D%0A%09  V result = value;%0A%09  value = null;%0A%09  notify();%0A%09  return result;%0A%09%7D%0A%09%0A%09public synchronized void set(V newValue) throws InterruptedException %7B%0A%09  while (value != null) %7B%0A%09    wait();%0A%09  %7D%0A%09  value = newValue;%0A%09  notify();%0A%09%7D%0A%0A%0A%0A%0A%7D%0A

add safebox implementation. will wait on value to be set or get