public static boolean printStacks(int pid, boolean useNative) {
    if (!useNative) {
      if (pid > 0 && pid != myPid[0]) {
        return false;
      }
      try (CharArrayWriter cw = new CharArrayWriter(50000)) {
        PrintWriter sb = new PrintWriter(cw, true);
        sb.append("\n******** full thread dump ********\n");
        ThreadMXBean bean = ManagementFactory.getThreadMXBean();
        long[] threadIds = bean.getAllThreadIds();
        ThreadInfo[] infos = bean.getThreadInfo(threadIds, true, true);
        long thisThread = Thread.currentThread().getId();
        for (int i = 0; i < infos.length; i++) {
          if (i != thisThread && infos[i] != null) {
            formatThreadInfo(infos[i], sb);
          }
        }
        sb.flush();
        logger.warn(cw.toString());
      }
      return true;
    } else {
      if (pid < 0) {
        checkPid(pid);
      }
      return _printStacks(pid);
    }
  }
Tells a process to print its stacks to its standard output or the given log writer

@param pid the id of the process that will print its stacks, or zero for the current process
@param useNative if true we attempt to use native code, which goes to stdout
@return true if the process was told; false if it does not exist or can not be told.
geode-logging/src/main/java/org/apache/geode/logging/internal/OSProcess.java