Browse Source

Polish

pull/31190/head
Andy Wilkinson 4 years ago
parent
commit
14af1bb2dc
  1. 8
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java

8
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java

@ -74,8 +74,7 @@ public class StopMojo extends AbstractMojo { @@ -74,8 +74,7 @@ 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);
}
@ -85,14 +84,13 @@ public class StopMojo extends AbstractMojo { @@ -85,14 +84,13 @@ 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);
}
}

Loading…
Cancel
Save