You have to keep checking a flag in your run method. This flag can be set to false when you want the thread to cancel.
The next time your run method checks for this flag, since its false hence it exits the thread.
May be you want to use a ThreadPoolExecutor?