Merge branch '2.7.x'
Closes gh-31178
This commit is contained in:
@@ -153,7 +153,7 @@ public class StartMojo extends AbstractApplicationRunMojo {
|
||||
}
|
||||
|
||||
private void doWaitForSpringApplication(MBeanServerConnection connection)
|
||||
throws IOException, MojoExecutionException, MojoFailureException {
|
||||
throws MojoExecutionException, MojoFailureException {
|
||||
final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
|
||||
try {
|
||||
execute(this.wait, this.maxAttempts, () -> (client.isReady() ? true : null));
|
||||
|
||||
@@ -74,7 +74,8 @@ public class StopMojo extends AbstractMojo {
|
||||
return;
|
||||
}
|
||||
getLog().info("Stopping application...");
|
||||
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
|
||||
try (JMXConnector connector = SpringApplicationAdminClient
|
||||
.connect(this.jmxPort)) {
|
||||
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
||||
stop(connection);
|
||||
}
|
||||
@@ -84,13 +85,14 @@ public class StopMojo extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
|
||||
private void stop(MBeanServerConnection connection) throws IOException, MojoExecutionException {
|
||||
private void stop(MBeanServerConnection connection) throws IOException, MojoExecutionException {
|
||||
try {
|
||||
new SpringApplicationAdminClient(connection, this.jmxName).stop();
|
||||
}
|
||||
catch (InstanceNotFoundException ex) {
|
||||
throw new MojoExecutionException(
|
||||
"Spring application lifecycle JMX bean not found. Could not stop application gracefully", ex);
|
||||
"Spring application lifecycle JMX bean not found. Could not stop application gracefully",
|
||||
ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user