public static List<Thread> getAllThreadsByThisName(String pattern) {
    List<Thread> threads = new ArrayList<>();
    for (Thread t : Thread.getAllStackTraces().keySet()) {
      if (t.getName().contains(pattern)) {
        threads.add(t);
      }
    }
    return threads;
  }
Return all the threads with a name that contains the given name.
@param pattern the pattern to compare
@return all the threads with a name that contains the given pattern.
ambry-test-utils/src/main/java/com/github/ambry/utils/TestUtils.java