title: How to make thread runs without any interruption
body: <p>I have a method and I want to run a thread by calling the method. But I can run a thread. But now my problem is I want my thread to run even if I call the method multiple times. For example I'm calling a method which calls the thread method and it starts run. Now I'm calling the method again and this should not cause the thread to run fro first rather it doesn't affect the previous running thread. I thought of using  Thread.isAlive();. But still stuck.</p>
  
  <pre><code>class MyRunnableThread implements Runnable{
  
      public static int myCount = 0;
      public MyRunnableThread(){
  
      }
      public void run() {
          while(MyRunnableThread.myCount &lt;= 10){
              try{
                  System.out.println("Expl Thread: "+(++MyRunnableThread.myCount));
                  Thread.sleep(100);
              } catch (InterruptedException iex) {
                  System.out.println("Exception in thread: "+iex.getMessage());
              }
          }
      }
  }
  public class RunMyThread {
      public void call(){
          System.out.println("Starting Main Thread...");
          MyRunnableThread mrt = new MyRunnableThread();
          Thread t = new Thread(mrt);
          t.start();
          while(MyRunnableThread.myCount &lt;= 10){
              try{
                  System.out.println("Main Thread: "+(++MyRunnableThread.myCount));
                  Thread.sleep(100);
              } catch (InterruptedException iex){
                  System.out.println("Exception in main thread: "+iex.getMessage());
              }
          }
          System.out.println("End of Main Thread...");
      }
  }
  
  
  public void CallThreadCaller()
  {
     call();
  }
  </code></pre>
  
  <p>Now I'm calling the call() method again and 
  it should not affect the previous thread running. It should check if its running or it should start the thread. But how to check if a thread is already running if we start a new instance.</p>