code: public Map<String,Map<String,String>> getAllThreadDumps() throws IOException, InterruptedException {
          checkPermission(ADMINISTER);
  
          // issue the requests all at once
          Map<String,Future<Map<String,String>>> future = new HashMap<>();
  
          for (Computer c : getComputers()) {
              try {
                  future.put(c.getName(), RemotingDiagnostics.getThreadDumpAsync(c.getChannel()));
              } catch(Exception e) {
                  LOGGER.info("Failed to get thread dump for node " + c.getName() + ": " + e.getMessage());
              }
          }
          if (toComputer() == null) {
              future.put("master", RemotingDiagnostics.getThreadDumpAsync(FilePath.localChannel));
          }
  
          // if the result isn't available in 5 sec, ignore that.
          // this is a precaution against hang nodes
          long endTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(5);
  
          Map<String,Map<String,String>> r = new HashMap<>();
          for (Entry<String, Future<Map<String, String>>> e : future.entrySet()) {
              try {
                  r.put(e.getKey(), e.getValue().get(endTime-System.currentTimeMillis(), TimeUnit.MILLISECONDS));
              } catch (Exception x) {
                  r.put(e.getKey(), Collections.singletonMap("Failed to retrieve thread dump", Functions.printThrowable(x)));
              }
          }
          return Collections.unmodifiableSortedMap(new TreeMap<>(r));
      }
docs: Obtains the thread dump of all agents (including the master.)
  
  <p>
  Since this is for diagnostics, it has a built-in precautionary measure against hang agents.