Class TimeOut

  • All Implemented Interfaces:
    java.lang.Runnable

    public class TimeOut
    extends java.lang.Object
    implements java.lang.Runnable
    Runnable to set an AtomicBoolean to true after a certain amount of time To be tested by anytime algorithms to know if they should stop running
    Author:
    nk-fouque
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeOut​(java.util.concurrent.atomic.AtomicBoolean cut, int seconds)  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.Thread planTimeOut​(java.util.concurrent.atomic.AtomicBoolean cut, int seconds)
      Starts a thread that will wait a certain time before setting a boolean to true Said boolean can then be used by algorithms to check if they should stop
      void run()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeOut

        public TimeOut​(java.util.concurrent.atomic.AtomicBoolean cut,
                       int seconds)
    • Method Detail

      • planTimeOut

        public static java.lang.Thread planTimeOut​(java.util.concurrent.atomic.AtomicBoolean cut,
                                                   int seconds)
        Starts a thread that will wait a certain time before setting a boolean to true Said boolean can then be used by algorithms to check if they should stop
        Parameters:
        cut - The AtomicBoolean that should be set to true
        seconds - The time to wait in seconds
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable