code: public void doWhenModelWalkerFinished(final ActionType type, final Runnable action) {
          memberLock.lock();
          if (!modelWalkingInProgess) {
              memberLock.unlock();
              action.run();
              return;
          }
          CountDownLatch latch = new CountDownLatch(1);
          Set<CountDownLatch> latches = getLocksForAction(type);
          latches.add(latch);
          // FIXME There may be a race condition between the following unlock and lock.
          memberLock.unlock();
          awaitUninterupptetly(latch);
  
          action.run();
  
          memberLock.lock();
          latches.remove(latch);
          runNext();
          memberLock.unlock();
      }
docs: Lets the current thread sleep until a currently running model walking thread has finished.
  
  <p>
  If no model walking is currently in progress, nothing happens.
  </p>
  
  @param type
  The type of the action that waits for model walking to finish.
  @param action
  The action that should be performed.