1066 |
|
* Checks that thread eventually enters the expected blocked thread state. |
1067 |
|
*/ |
1068 |
|
void assertThreadBlocks(Thread thread, Thread.State expected) { |
1069 |
< |
// always sleep at least 1 ms, avoiding transitional states |
1070 |
< |
// with high probability |
1069 |
> |
// always sleep at least 1 ms, with high probability avoiding |
1070 |
> |
// transitory states |
1071 |
|
for (long retries = LONG_DELAY_MS * 3 / 4; retries-->0; ) { |
1072 |
|
try { delay(1); } |
1073 |
|
catch (InterruptedException fail) { |
1085 |
|
/** |
1086 |
|
* Checks that thread does not terminate within the default |
1087 |
|
* millisecond delay of {@code timeoutMillis()}. |
1088 |
+ |
* TODO: REMOVEME |
1089 |
|
*/ |
1090 |
|
void assertThreadStaysAlive(Thread thread) { |
1091 |
|
assertThreadStaysAlive(thread, timeoutMillis()); |
1093 |
|
|
1094 |
|
/** |
1095 |
|
* Checks that thread does not terminate within the given millisecond delay. |
1096 |
+ |
* TODO: REMOVEME |
1097 |
|
*/ |
1098 |
|
void assertThreadStaysAlive(Thread thread, long millis) { |
1099 |
|
try { |
1108 |
|
/** |
1109 |
|
* Checks that the threads do not terminate within the default |
1110 |
|
* millisecond delay of {@code timeoutMillis()}. |
1111 |
+ |
* TODO: REMOVEME |
1112 |
|
*/ |
1113 |
|
void assertThreadsStayAlive(Thread... threads) { |
1114 |
|
assertThreadsStayAlive(timeoutMillis(), threads); |
1116 |
|
|
1117 |
|
/** |
1118 |
|
* Checks that the threads do not terminate within the given millisecond delay. |
1119 |
+ |
* TODO: REMOVEME |
1120 |
|
*/ |
1121 |
|
void assertThreadsStayAlive(long millis, Thread... threads) { |
1122 |
|
try { |