org.linkedin.util-core/src/main/java/org/linkedin/util/concurrent/ThreadControl.java
public Object blockWithException(Object key) throws Exception
  {
    Object value = block(key);

    if(value instanceof Exception)
    {
      Exception exception = (Exception) value;
      throw exception;
    }

    return value;
  }
public Object blockWithException(Object key) throws Exception
  {
    Object value = block(key);

    if(value instanceof Exception)
    {
      Exception exception = (Exception) value;
      throw exception;
    }

    return value;
  }
This method is usually called from within a mock object to execute the call associated
to the given key. It will block until another thread calls one of the <code>unblock</code>
method with the object to return. If the object to return is an exception it will throw
it instead!

@param key same key as used in <code>unblock</code>
@return the object provided to <code>unblock</code>