Uploaded image for project: 'Commons Exec'
  1. Commons Exec
  2. EXEC-55

Set names for started threads

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1
    • 1.2
    • None

    Description

      Currently some threads are started without names, this makes it harder to read thread dumps, especially in large applications with many threads.

      The following patch fixes this for the places that I could identify:

      ### Eclipse Workspace Patch 1.0
      #P commons-exec-trunk
      Index: src/main/java/org/apache/commons/exec/DefaultExecutor.java
      ===================================================================
      --- src/main/java/org/apache/commons/exec/DefaultExecutor.java	(revision 1071645)
      +++ src/main/java/org/apache/commons/exec/DefaultExecutor.java	(working copy)
      @@ -181,7 +181,7 @@
                   throw new IOException(workingDirectory + " doesn't exist.");
               }
       
      -        executorThread = new Thread() {
      +        executorThread = new Thread("Default Executor") {
                   public void run() {
                       int exitValue = Executor.INVALID_EXITVALUE;
                       try {                    
      Index: src/main/java/org/apache/commons/exec/PumpStreamHandler.java
      ===================================================================
      --- src/main/java/org/apache/commons/exec/PumpStreamHandler.java	(revision 1071645)
      +++ src/main/java/org/apache/commons/exec/PumpStreamHandler.java	(working copy)
      @@ -284,7 +284,7 @@
           protected Thread createPump(final InputStream is, final OutputStream os,
                   final boolean closeWhenExhausted) {
               final Thread result = new Thread(new StreamPumper(is, os,
      -                closeWhenExhausted));
      +                closeWhenExhausted), "Stream Pumper");
               result.setDaemon(true);
               return result;
           }
      @@ -300,7 +300,7 @@
            */
           private Thread createSystemInPump(InputStream is, OutputStream os) {
               inputStreamPumper = new InputStreamPumper(is, os);
      -        final Thread result = new Thread(inputStreamPumper);
      +        final Thread result = new Thread(inputStreamPumper, "Input Stream Pumper");
               result.setDaemon(true);
               return result;
           }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sgoeschl Siegfried Goeschl
            dominik.stadler@gmx.at Dominik Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment