Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
7ba575d3
Commit
7ba575d3
authored
Jun 15, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent RestarterTests.testRestart from triggering unwanted restarts
See gh-26900
parent
32effdba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
RestarterTests.java
...springframework/boot/devtools/restart/RestarterTests.java
+3
-15
No files found.
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java
View file @
7ba575d3
...
...
@@ -22,6 +22,7 @@ import java.time.Duration;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
org.awaitility.Awaitility
;
import
org.junit.jupiter.api.AfterEach
;
...
...
@@ -177,7 +178,7 @@ class RestarterTests {
private
int
count
=
0
;
private
static
volatile
boolean
quit
=
false
;
private
static
final
AtomicBoolean
restart
=
new
AtomicBoolean
()
;
@Scheduled
(
fixedDelay
=
200
)
void
tickBean
()
{
...
...
@@ -186,8 +187,7 @@ class RestarterTests {
@Scheduled
(
initialDelay
=
500
,
fixedDelay
=
500
)
void
restart
()
{
System
.
out
.
println
(
"Restart "
+
Thread
.
currentThread
());
if
(!
SampleApplication
.
quit
)
{
if
(
SampleApplication
.
restart
.
compareAndSet
(
false
,
true
))
{
Restarter
.
getInstance
().
restart
();
}
}
...
...
@@ -198,18 +198,6 @@ class RestarterTests {
SampleApplication
.
class
);
context
.
addApplicationListener
(
new
CloseCountingApplicationListener
());
Restarter
.
getInstance
().
prepare
(
context
);
System
.
out
.
println
(
"Sleep "
+
Thread
.
currentThread
());
sleep
();
quit
=
true
;
}
private
static
void
sleep
()
{
try
{
Thread
.
sleep
(
1200
);
}
catch
(
InterruptedException
ex
)
{
// Ignore
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment