1116 |
|
} |
1117 |
|
|
1118 |
|
/** |
1119 |
– |
* Checks that thread does not terminate within the default |
1120 |
– |
* millisecond delay of {@code timeoutMillis()}. |
1121 |
– |
* TODO: REMOVEME |
1122 |
– |
*/ |
1123 |
– |
void assertThreadStaysAlive(Thread thread) { |
1124 |
– |
assertThreadStaysAlive(thread, timeoutMillis()); |
1125 |
– |
} |
1126 |
– |
|
1127 |
– |
/** |
1128 |
– |
* Checks that thread does not terminate within the given millisecond delay. |
1129 |
– |
* TODO: REMOVEME |
1130 |
– |
*/ |
1131 |
– |
void assertThreadStaysAlive(Thread thread, long millis) { |
1132 |
– |
try { |
1133 |
– |
// No need to optimize the failing case via Thread.join. |
1134 |
– |
delay(millis); |
1135 |
– |
assertTrue(thread.isAlive()); |
1136 |
– |
} catch (InterruptedException fail) { |
1137 |
– |
threadFail("Unexpected InterruptedException"); |
1138 |
– |
} |
1139 |
– |
} |
1140 |
– |
|
1141 |
– |
/** |
1142 |
– |
* Checks that the threads do not terminate within the default |
1143 |
– |
* millisecond delay of {@code timeoutMillis()}. |
1144 |
– |
* TODO: REMOVEME |
1145 |
– |
*/ |
1146 |
– |
void assertThreadsStayAlive(Thread... threads) { |
1147 |
– |
assertThreadsStayAlive(timeoutMillis(), threads); |
1148 |
– |
} |
1149 |
– |
|
1150 |
– |
/** |
1151 |
– |
* Checks that the threads do not terminate within the given millisecond delay. |
1152 |
– |
* TODO: REMOVEME |
1153 |
– |
*/ |
1154 |
– |
void assertThreadsStayAlive(long millis, Thread... threads) { |
1155 |
– |
try { |
1156 |
– |
// No need to optimize the failing case via Thread.join. |
1157 |
– |
delay(millis); |
1158 |
– |
for (Thread thread : threads) |
1159 |
– |
assertTrue(thread.isAlive()); |
1160 |
– |
} catch (InterruptedException fail) { |
1161 |
– |
threadFail("Unexpected InterruptedException"); |
1162 |
– |
} |
1163 |
– |
} |
1164 |
– |
|
1165 |
– |
/** |
1119 |
|
* Checks that future.get times out, with the default timeout of |
1120 |
|
* {@code timeoutMillis()}. |
1121 |
|
*/ |