1206 |
|
} |
1207 |
|
} |
1208 |
|
|
1209 |
+ |
/** |
1210 |
+ |
* A fixed delay task with overflowing period should not prevent a |
1211 |
+ |
* one-shot task from executing. |
1212 |
+ |
* https://bugs.openjdk.java.net/browse/JDK-8051859 |
1213 |
+ |
*/ |
1214 |
+ |
public void testScheduleWithFixedDelay_overflow() throws Exception { |
1215 |
+ |
final CountDownLatch delayedDone = new CountDownLatch(1); |
1216 |
+ |
final CountDownLatch immediateDone = new CountDownLatch(1); |
1217 |
+ |
final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); |
1218 |
+ |
try (PoolCleaner cleaner = cleaner(p)) { |
1219 |
+ |
final Runnable immediate = new Runnable() { public void run() { |
1220 |
+ |
immediateDone.countDown(); |
1221 |
+ |
}}; |
1222 |
+ |
final Runnable delayed = new Runnable() { public void run() { |
1223 |
+ |
delayedDone.countDown(); |
1224 |
+ |
p.submit(immediate); |
1225 |
+ |
}}; |
1226 |
+ |
p.scheduleWithFixedDelay(delayed, 0L, Long.MAX_VALUE, SECONDS); |
1227 |
+ |
await(delayedDone); |
1228 |
+ |
await(immediateDone); |
1229 |
+ |
} |
1230 |
+ |
} |
1231 |
+ |
|
1232 |
|
} |