Package implementation.utils
Class TimeOut
- java.lang.Object
-
- implementation.utils.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 stopvoid
run()
-
-
-
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 trueseconds
- The time to wait in seconds
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
-