public static int numThreadsByThisName(String pattern) {
    int count = 0;
    for (Thread t : Thread.getAllStackTraces().keySet()) {
      if (t.getName().contains(pattern)) {
        count++;
      }
    }
    return count;
  }
Return the number of threads currently running with a name containing the given pattern.
@param pattern the pattern to compare
@return the number of threads currently running with a name containing the given pattern.
ambry-test-utils/src/main/java/com/github/ambry/utils/TestUtils.java