|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.tests.harness.TestBarrier
public class TestBarrier
This class acts as an implementation of a barrier that is appropriate for concurrency test cases that want to fail if a thread fails to achieve a particular state in a reasonable amount of time. This prevents test suites from hanging indefinitely if a concurrency bug is found that would normally result in an indefinite hang.
Field Summary | |
---|---|
static int |
STATUS_BLOCKED
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_DONE
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_RUNNING
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_START
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_WAIT_FOR_DONE
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_WAIT_FOR_RUN
Convience status constant that can be interpreted differently by each test. |
static int |
STATUS_WAIT_FOR_START
Convience status constant that can be interpreted differently by each test. |
Constructor Summary | |
---|---|
TestBarrier()
Creates a new test barrier suitable for a single thread |
|
TestBarrier(int[] location,
int index)
Creates a new test barrier on the provided status array, suitable for acting as a barrier for multiple threads. |
Method Summary | |
---|---|
void |
setStatus(int status)
Sets this barrier object's status. |
void |
waitForStatus(int status)
Blocks the current thread until the receiver's status is set to the given value. |
static void |
waitForStatus(int[] location,
int status)
|
static void |
waitForStatus(int[] location,
int index,
int status)
Blocks the current thread until the given variable is set to the given value Times out after a predefined period to avoid hanging tests |
void |
waitForStatusNoFail(int status)
The same as other barrier methods, except it will not fail if the job does not start in a "reasonable" time. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATUS_BLOCKED
public static final int STATUS_DONE
public static final int STATUS_RUNNING
public static final int STATUS_START
public static final int STATUS_WAIT_FOR_DONE
public static final int STATUS_WAIT_FOR_RUN
public static final int STATUS_WAIT_FOR_START
Constructor Detail |
---|
public TestBarrier()
public TestBarrier(int[] location, int index)
Method Detail |
---|
public static void waitForStatus(int[] location, int status)
public static void waitForStatus(int[] location, int index, int status)
public void setStatus(int status)
public void waitForStatus(int status)
public void waitForStatusNoFail(int status)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |