title: Executor framework future.get() hangs
body: <p>I have the following code that runs a process and I want to know if there was an exception while running it. It hangs for no reason</p>
  
  <pre><code>Runtime runtime = Runtime.getRuntime();
  proc = runtime.exec(command.toString());
  ProcessHandler errorStream = new ProcessHandler(proc.getErrorStream(),"ERROR", rdyFilePath);
  ExecutorService pool = Executors.newSingleThreadExecutor();
  Future future = pool.submit(errorStream);
  pool.shutdown();
  
  try {
       if(future.get() == null) {
           log.info("Done completing error thread");
       }
  } catch (InterruptedException | ExecutionException e) {
       e.printStackTrace();
  }
  </code></pre>
  
  <p>Here is the class for process handler</p>
  
  <pre><code>public class ProcessHandler implements Callable&lt;Integer&gt; {
  
      private static Logger log = Logger.getLogger(ProcessHandler.class.getName());
  
      InputStream inpStr;
      String strType;
      String rdyFile;
  
  
      public ProcessHandler(InputStream inpStr, String strType, String rdyFile) {
          this.inpStr = inpStr;
          this.strType = strType;
          this.rdyFile = rdyFile;
      }
  
      public Integer call() throws FileMetadataException {
          StringBuffer sb = new StringBuffer();
          try {
  
              InputStreamReader inpStrd = new InputStreamReader(inpStr);
              BufferedReader buffRd = new BufferedReader(inpStrd);
              String line = null;
              while((line = buffRd.readLine()) != null) {
                  if("ERROR".equalsIgnoreCase(strType)) {
  
                      sb.append(line + "\n");
                      log.info(strType + "-&gt;" + line);
                  }
              }
              if(sb != null) {
                  log.info("Error Stream length : " + sb.length());
                  throw new RuntimeException();
  
              }
  
              buffRd.close();
          } catch(IOException e) {
              log.error("IOException in ProcessHandler Thread" + e.fillInStackTrace());
              System.err.println(e);
              throw new FileMetadataException();
          } finally {
              if(sb != null) {
                  if(sb.toString().length() &gt; 0 ) {
                      log.error("Error string buffer length " + sb.length());
                      // do not create rdy file
                  } else {
                      log.error("Error string buffer length : " + sb.length());
                      File f = new File(rdyFile);
                          try {
                              f.createNewFile();
                          } catch(IOException e) {
                              log.error("IOException while creating rdy file");
                          }
                      }
                      // create rdy file. 
                  }
              }
              return sb.length();
          }
  
      }
  }
  </code></pre>