Polish
This commit is contained in:
parent
26b89bfc80
commit
14af1bb2dc
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
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…
Reference in New Issue