title: Terminate Java Fx Application While loop in Runnable Class
body: <p>I had this class</p>
  <pre><code>public class EXEC implements Runnable{
   private final AtomicBoolean running = new AtomicBoolean(false);
  
   WebDriver driver;
  public EXEC(WebDriver driver) {
      this.driver = driver;
  }     
  public void stop() {
      running.set(false);
  }
  
  @Override
  public void run() {
      // TODO Auto-generated method stub
      String pass=SampleController.getMyVariable();
       running.set(true);
       while(running.get()){
      int i=1;
      i++;
      System.out.println(i);
   }
       Platform.exit();
  }
  }
  </code></pre>
  <p>At UI Controller Class
  I assigned Run and  Quit button with method like this</p>
  <pre><code>EXEC mythread=  new EXEC(drivers);
  
  public void run()
  {mythread.run();}
  
  public void quit()
  { mythread.stop();}
  </code></pre>
  <p><code>mythread.run()</code> worked for me.However It wasn't terminated
  by <code>mythread.stop();</code>. Please help me how to get it</p>