title: Killing a thread or an asynchronous task
body: <p>let's say I use a jar that IBM has created. 
  Let's say that this Jar has a function that I need but is ultimately build as such:</p>
  
  <pre><code> while (true) {
       System.out.println(1)
   }
  </code></pre>
  
  <p>(of course it doesn't really just printing 1, but for the example let's say it is)
  So, I made the call to the function that does it in another thread using future. How can I completely kill the thread that this code is running in? Or alternatively, how can I kill the asynchronous task in Kotlin that runs the code.</p>
  
  <p>Solutions in Kotlin or Java will be great,
  thanks in advance!</p>
  
  <p>EDIT:</p>
  
  <p>I've found out, that if this is a thread, I can <code>Thread#stop()</code> it to really make it stop. But unfortunately making the constructor throwing exceptions multiple times, causes the JVM to erase the class from memory causing a <code>NoClassDefFoundError</code> when instantiating the class the next time.. </p>