public static void runUnderLock(ReentrantLock lock,Runnable runnable){
  lock.lock();
  try {
    runnable.run();
  }
  finally {
    lock.unlock();
  }
}

public static void runUnderLock ( ReentrantLock lock , Runnable runnable ) { lock . lock ( ) ; try { runnable . run ( ) ; } finally { lock . unlock ( ) ; } }
run given runnable under given lock
