|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2017 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -254,24 +254,14 @@ public void verifyShutdownWithoutWaitingByDefault() throws Exception {
|
254 | 254 |
|
255 | 255 | @Test
|
256 | 256 | public void verifyShutdownWithWait() throws Exception {
|
257 |
| - delayHandler.setDefaultDelay(5000); |
258 |
| - taskScheduler.setWaitForTasksToCompleteOnShutdown(true); |
259 |
| - this.startDelayerHandler(); |
260 |
| - delayHandler.handleMessage(new GenericMessage<String>("foo")); |
261 |
| - taskScheduler.destroy(); |
| 257 | + this.delayHandler.setDefaultDelay(100); |
| 258 | + this.taskScheduler.setWaitForTasksToCompleteOnShutdown(true); |
| 259 | + startDelayerHandler(); |
| 260 | + this.delayHandler.handleMessage(new GenericMessage<>("foo")); |
| 261 | + this.taskScheduler.destroy(); |
262 | 262 |
|
263 |
| - final CountDownLatch latch = new CountDownLatch(1); |
264 |
| - new Thread(() -> { |
265 |
| - try { |
266 |
| - taskScheduler.getScheduledExecutor().awaitTermination(10000, TimeUnit.MILLISECONDS); |
267 |
| - latch.countDown(); |
268 |
| - } |
269 |
| - catch (InterruptedException e) { |
270 |
| - // won't countDown |
271 |
| - } |
272 |
| - }).start(); |
273 |
| - latch.await(50, TimeUnit.MILLISECONDS); |
274 |
| - assertEquals(1, latch.getCount()); |
| 263 | + assertTrue(this.taskScheduler.getScheduledExecutor().awaitTermination(10, TimeUnit.SECONDS)); |
| 264 | + assertTrue(this.latch.await(10, TimeUnit.SECONDS)); |
275 | 265 | }
|
276 | 266 |
|
277 | 267 | @Test(expected = MessageDeliveryException.class)
|
|
0 commit comments