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
dfd327d6
Commit
dfd327d6
authored
Nov 16, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish multiple root contexts in `Restarter`
See gh-7335 See gh-7336
parent
34fb909b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
RestartApplicationListener.java
...ork/boot/devtools/restart/RestartApplicationListener.java
+12
-5
Restarter.java
.../org/springframework/boot/devtools/restart/Restarter.java
+3
-6
No files found.
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java
View file @
dfd327d6
...
@@ -45,15 +45,14 @@ public class RestartApplicationListener
...
@@ -45,15 +45,14 @@ public class RestartApplicationListener
onApplicationStartingEvent
((
ApplicationStartingEvent
)
event
);
onApplicationStartingEvent
((
ApplicationStartingEvent
)
event
);
}
}
if
(
event
instanceof
ApplicationPreparedEvent
)
{
if
(
event
instanceof
ApplicationPreparedEvent
)
{
Restarter
.
getInstance
()
onApplicationPreparedEvent
((
ApplicationPreparedEvent
)
event
);
.
prepare
(((
ApplicationPreparedEvent
)
event
).
getApplicationContext
());
}
}
if
(
event
instanceof
ApplicationReadyEvent
if
(
event
instanceof
ApplicationReadyEvent
||
event
instanceof
ApplicationFailedEvent
)
{
||
event
instanceof
ApplicationFailedEvent
)
{
Restarter
.
getInstance
().
finish
();
Restarter
.
getInstance
().
finish
();
if
(
event
instanceof
ApplicationFailedEvent
)
{
}
Restarter
.
getInstance
().
remove
(((
ApplicationFailedEvent
)
event
).
getApplicationContext
());
if
(
event
instanceof
ApplicationFailedEvent
)
{
}
onApplicationFailedEvent
((
ApplicationFailedEvent
)
event
);
}
}
}
}
...
@@ -72,6 +71,14 @@ public class RestartApplicationListener
...
@@ -72,6 +71,14 @@ public class RestartApplicationListener
}
}
}
}
private
void
onApplicationPreparedEvent
(
ApplicationPreparedEvent
event
)
{
Restarter
.
getInstance
().
prepare
(
event
.
getApplicationContext
());
}
private
void
onApplicationFailedEvent
(
ApplicationFailedEvent
event
)
{
Restarter
.
getInstance
().
remove
(
event
.
getApplicationContext
());
}
@Override
@Override
public
int
getOrder
()
{
public
int
getOrder
()
{
return
this
.
order
;
return
this
.
order
;
...
...
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java
View file @
dfd327d6
...
@@ -52,7 +52,6 @@ import org.springframework.context.ConfigurableApplicationContext;
...
@@ -52,7 +52,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -316,11 +315,9 @@ public class Restarter {
...
@@ -316,11 +315,9 @@ public class Restarter {
this
.
logger
.
debug
(
"Stopping application"
);
this
.
logger
.
debug
(
"Stopping application"
);
this
.
stopLock
.
lock
();
this
.
stopLock
.
lock
();
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
this
.
rootContexts
))
{
for
(
ConfigurableApplicationContext
context
:
this
.
rootContexts
)
{
for
(
ConfigurableApplicationContext
rootContext
:
this
.
rootContexts
)
{
context
.
close
();
rootContext
.
close
();
this
.
rootContexts
.
remove
(
context
);
}
this
.
rootContexts
.
clear
();
}
}
cleanupCaches
();
cleanupCaches
();
if
(
this
.
forceReferenceCleanup
)
{
if
(
this
.
forceReferenceCleanup
)
{
...
...
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