@Override
  public Object getObject(Object key) {
    acquireLock(key);
    Object value = delegate.getObject(key);
    if (value != null) {
      releaseLock(key);
    }        
    return value;
  }
Simple blocking decorator 

Sipmle and inefficient version of EhCache's BlockingCache decorator.
It sets a lock over a cache key when the element is not found in cache.
This way, other threads will wait until this element is filled instead of hitting the database.

@author Eduardo Macarron
src/main/java/org/apache/ibatis/cache/decorators/BlockingCache.java