public void run() {
      while (true) {
        f();
      }
    }
There is absolutely nothing you can do when you have
deadlocked threads.  You cannot stop them, you cannot
interrupt them, you cannot tell them to stop trying to
get a lock, and you also cannot tell them to let go of
the locks that they own.
ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java