code: private static void listAllOpenFileDescriptors(PrintWriter writer) throws IOException, InterruptedException {
          writer.println();
          writer.println("All open files");
          writer.println("==============");
          File[] files = new File("/proc/self/fd").listFiles();
          if (files != null) {
              for (File file : files) {
                  try {
                      writer.println(Util.resolveSymlink(file));
                  } catch (IOException e) {
                      // If we fail to resolve the symlink, just print the file.
                      writer.println(file.getCanonicalPath());
                  }
              }
          }
      }
docs: * List all the open file descriptors. For Unix systems this information can be obtained by
  * going to /proc/self/fd. This will translate self to the correct PID of the current java
  * process. Each file in the folder is a symlink to the location of the file descriptor.