title: Text is not getting printed once the Threads are done
body: <p>Please have a look at the following code.</p>
  
  <pre><code>public class BigFileWholeProcessor {
      private static final int NUMBER_OF_THREADS = 2;
      public void processFile(String fileName) {
  
          BlockingQueue&lt;String&gt; fileContent = new LinkedBlockingQueue&lt;String&gt;();
          BigFileReader bigFileReader = new BigFileReader(fileName, fileContent);
          BigFileProcessor bigFileProcessor = new BigFileProcessor(fileContent);
          ExecutorService es = Executors.newFixedThreadPool(NUMBER_OF_THREADS);
          es.execute(bigFileReader);
          es.execute(bigFileProcessor);
          es.shutdown();
  
          if(es.isTerminated())
          {
              System.out.println("Completed Work");
          }
  
      }
  }
  
  
  
  public class BigFileReader implements Runnable {
      private final String fileName;
      int a = 0;
      public static final String SENTINEL = "SENTINEL";
  
      private final BlockingQueue&lt;String&gt; linesRead;
      public BigFileReader(String fileName, BlockingQueue&lt;String&gt; linesRead) {
          this.fileName = fileName;
          this.linesRead = linesRead;
      }
      @Override
      public void run() {
          try {
              //since it is a sample, I avoid the manage of how many lines you have read
              //and that stuff, but it should not be complicated to accomplish
              BufferedReader br = new BufferedReader(new FileReader(new File("E:/Amazon HashFile/Hash.txt")));
              String str = "";
  
              while((str=br.readLine())!=null)
              {
                  linesRead.put(str);
                  System.out.println(a);
                  a++;
              }
              linesRead.put(SENTINEL);
  
          } catch (Exception ex) {
              ex.printStackTrace();
          }
  
          System.out.println("Completed");
      }
  }
  
  
  
  public class BigFileProcessor implements Runnable {
      private final BlockingQueue&lt;String&gt; linesToProcess;
      public BigFileProcessor (BlockingQueue&lt;String&gt; linesToProcess) {
          this.linesToProcess = linesToProcess;
      }
      @Override
      public void run() {
          String line = "";
          try {
              while ( (line = linesToProcess.take()) != null) {
                  //do what you want/need to process this line...
  
                  if(line==BigFileReader.SENTINEL)
                  {
                      break;
                  }
                  String [] pieces = line.split("(...)/g");
              }
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>I want to print the text "completed work" in <code>BigFileWholeProcessor</code> once all the thread work is done. But instead, it is not getting printed. Why is this? How to identify that all the threads are done and need printing?</p>