title: How to terminate all prior threads if a thread of the same type is run [JavaFX]
body: <p>so suppose I have a function that runs Thread1 called fucntionA
  Now Thread 1 takes 10 seconds to run and finish</p>
  
  <p>But suppose I call function A again, within 5 seconds of calling it the first time, such that the first instance of Thread1 is still running</p>
  
  <p>I want the first instance of Thread1 to terminate, once the new instance is called.</p>
  
  <p>How can I achieve this?</p>