Class CancellableThread

java.lang.Object
java.lang.Thread
com.xinapse.util.CancellableThread
All Implemented Interfaces:
Runnable

public class CancellableThread extends Thread
A class to implement a cancellable Thread. Thread cancellation is achieved by setting the flag. It is up to the thread's run method to check this flag periodically and return if set.
  • Field Details

    • flag

      protected CancellableThread.Flag flag
      The flag that is set by the cencel() method in order to cancel this Thread.
  • Constructor Details

    • CancellableThread

      public CancellableThread()
  • Method Details

    • cancel

      public void cancel()
      Signal the CancellableThread to stop any processing and return.
    • isCancelled

      public boolean isCancelled()
      Tests whether this CancellableThread has been cancelled.
      Returns:
      true if this CancellableThread has been cancelled by the user; false otherwise.