Package org.hotswap.agent.util.test
Class WaitHelper
- java.lang.Object
-
- org.hotswap.agent.util.test.WaitHelper
-
public class WaitHelper extends Object
Convenience class to waitForResult for an event to occur.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWaitHelper.CommandHolder to share result between threads.static classWaitHelper.ResultHolderHolder to share result between threads.
-
Constructor Summary
Constructors Constructor Description WaitHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanwaitForCommand(WaitHelper.Command command)Wait for custom command to return true.static booleanwaitForCommand(WaitHelper.Command command, int timeout)Wait for custom command to return true.static booleanwaitForResult(WaitHelper.ResultHolder resultHolder)Wait for result set to true by another thread in resultHolder.static booleanwaitForResult(WaitHelper.ResultHolder resultHolder, int timeout)Wait for result set to true by another thread in resultHolder.
-
-
-
Method Detail
-
waitForResult
public static boolean waitForResult(WaitHelper.ResultHolder resultHolder)
Wait for result set to true by another thread in resultHolder. Default timeout 1000ms.- Parameters:
resultHolder- holder of a boolean result - wait for value "true"- Returns:
- true if value was set during timeout
-
waitForResult
public static boolean waitForResult(WaitHelper.ResultHolder resultHolder, int timeout)
Wait for result set to true by another thread in resultHolder.- Parameters:
resultHolder- holder of a boolean result - wait for value "true"timeout- how long to wait- Returns:
- true if value was set during timeout
-
waitForCommand
public static boolean waitForCommand(WaitHelper.Command command)
Wait for custom command to return true. Default timeout 1000ms.- Parameters:
command- wait for "true"- Returns:
- true if command returned true during command
-
waitForCommand
public static boolean waitForCommand(WaitHelper.Command command, int timeout)
Wait for custom command to return true. Default timeout 1000ms.- Parameters:
command- wait for return "true" value- Returns:
- true if command returned true during command
-
-