title: Java break or exit from a thread
body: <p>I have a thread that performs several different tasks. Each task is dependent on the previous one being successful. </p>
  
  <p>If this were a method I might write (long hand) :</p>
  
  <pre><code>public boolean outerMethod()
  {
      boolean success= performTask();
  
      if(success == false)
      {
          return false;
      } 
  
     // more processing here if success == true
  }
  </code></pre>
  
  <p>and come out of the <code>outerMethod</code> back to the caller, and no further processing takes place</p>
  
  <p>But... </p>
  
  <p>If I am in the <code>run()</code> method of a thread and I do something like shown below... </p>
  
  <p>How can I end the current thread there and then? </p>
  
  <pre><code>public void run()
  {
      boolean success = performTask();
  
      if( success == false )
      {
          /* here is where I want to exit this thread */
      }   
  
      // further processing if success == true
  }
  </code></pre>