From ea5284ca918b62dcab70ef38710f060890c0960f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 28 Jul 2020 09:03:57 +0100 Subject: [PATCH] Polish "Use milliseconds when configuring awaitTerminationPeriod" See gh-22604 --- .../springframework/boot/task/TaskExecutorBuilder.java | 2 +- .../boot/task/TaskExecutorBuilderTests.java | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java index 960d57ffa787..94996b1a1244 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java index cb0d9caf55bf..9a2582434990 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java @@ -61,14 +61,10 @@ void awaitTerminationShouldApply() { } @Test - void awaitTerminationPeriodShouldApply() { - Duration period = Duration.ofMinutes(1); + void awaitTerminationPeriodShouldApplyWithMillisecondPrecision() { + Duration period = Duration.ofMillis(50); ThreadPoolTaskExecutor executor = this.builder.awaitTerminationPeriod(period).build(); assertThat(executor).hasFieldOrPropertyWithValue("awaitTerminationMillis", period.toMillis()); - - period = Duration.ofMillis(50); - executor = this.builder.awaitTerminationPeriod(period).build(); - assertThat(executor).hasFieldOrPropertyWithValue("awaitTerminationMillis", period.toMillis()); } @Test