title: search for a file with multiple threads
body: <p>I am developing an simple searching tool for my purpose.
  My intention is to search all files or specific file under the specified folder.
  I thought  to do with multiple threads.
  Each thread will start searching for a file and put that file into a list if that file 
  does not contain in the list.
  So each thread will not scan for the same file .</p>
  
  <p>I am not sure this is the right approach or not.
  And when I run the program, I could see the same result when I use one thread,two
  and even more than two.</p>
  
  <p>Then I used Executor service, still I am getting the same executing time.I could not 
  find the difference. My questions are below.</p>
  
  <p>1.Am I using right logic for searching file with multiple threads?</p>
  
  <p>2.can I get the difference when executing with one thread,two threads,etc?</p>
  
  <pre><code>import java.io.File;
  import java.util.ArrayList;
  import java.util.List;
  
  public class FileReaderRunnable implements Runnable {
  
      private List&lt;File&gt; fileList = new ArrayList&lt;&gt;();
      private File mfile;
  
      public boolean finished;
      public FileReaderRunnable(File file) {
          this.mfile = file;
      }
  
      @Override
      public void run() {
          //System.out.println("Thread current:"+Thread.currentThread().getName());
          //while(!finished){
              getfiles(mfile);
              //finished = false;
          //}
  
      }
  
      public void setFlag(boolean value) {
          finished = value;
      }
  
      public void getfiles(File file) {
          System.out.println("EXecuting...: "+Thread.currentThread().getName()+file.getAbsolutePath());
          File[] listFiles = file.listFiles();
          if (listFiles != null &amp;&amp; listFiles.length &gt; 0) {
              for (File file2 : listFiles) {
                  if(!fileList.contains(file2.getAbsoluteFile())){
                      fileList.add(file2.getAbsoluteFile());  
                  }               
                  getfiles(file2);
              }
          }
      }
  
      public List&lt;File&gt; getFiles(){
          return fileList ;
      }
  
  }
  
  public class FileReaderThreadMain { 
      public static void main(String[] args) {        
          ExecutorService executor = Executors.newFixedThreadPool(30);
          File file = new File("C:\\Temp");
          FileReaderRunnable r = new FileReaderRunnable(file);
          long startTime = System.nanoTime();
          executor.execute(r);    
          executor.shutdown();
          // Wait until all threads are finish
          while (!executor.isTerminated()) { 
          }       
          long endTime = System.nanoTime();       
          System.out.println("\nFinished all threads");   
          System.out.println("main thread exited");       
          List&lt;File&gt; files = r.getFiles();
          System.out.println("Total Files size: "+files.size());      
          long duration = (endTime - startTime);
          System.out.println("Duration: "+duration/1000000 );     
      }
  
  }
  </code></pre>