title: Interrupting a normally running thread in java
body: <p>I am trying to interrupt a normally running thread (which is not in sleep() or wait() state) .</p>
  
  <p>while going through in net i got to know interrupting a normally running thread will just set the flag true and continue the process.</p>
  
  <p>Code snippet is </p>
  
  <p><code>one.java</code></p>
  
  <pre><code>......
  ......
  actionperformedmethod {
  
  if (actionCmd.equals("cancel")) {
      try {
          r1.stop();  // to two.java
      } catch (InterruptedException ex) {
          ....
          ....
      }
  }
  }
  </code></pre>
  
  <p>in <code>two.java</code></p>
  
  <pre><code>.....
  .....
  stop method() throws InterruptedException{
          if(!(t.isInterrupted())){
              t.interrupt();
              throw new InterruptedException();
          }
  }
  </code></pre>
  
  <p>from two.java when i throw InterruptedException i can able to get the exception block at one.java , but how do i stop the thread after that because even after that thread seems to continue the normal process.</p>
  
  <p>Am new to thread concepts please help..</p>