public static void flushCaches() {
    doFlush();
    flushLock.writeLock().lock(); // wait until all doFlush in other threads are finished. TODO-ank: cooperate, not wait
    flushLock.writeLock().unlock();
  }
public static void flushCaches()