public class Timeout
extends java.lang.Object
Constructor and Description |
---|
Timeout(java.lang.String name,
long value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
check()
Throws a TimeoutExpiredException exception if timeout has been expired.
|
boolean |
expired()
Checks if timeout has been expired after start() invocation.
|
java.lang.String |
getName()
Returns timeout name.
|
long |
getValue()
Returns timeout value.
|
void |
sleep()
Sleeps for timeout value.
|
void |
start()
Starts timeout measuring.
|
public Timeout(java.lang.String name, long value)
name
- Timeout name.value
- Timeout value in milliseconds.public java.lang.String getName()
public long getValue()
public void sleep()
public void start()
public boolean expired()
public void check()
TimeoutExpiredException
- if timeout has been expired after start() invocation.