Polish
This commit is contained in:
parent
26b89bfc80
commit
14af1bb2dc
|
|
@ -74,8 +74,7 @@ public class StopMojo extends AbstractMojo {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getLog().info("Stopping application...");
|
getLog().info("Stopping application...");
|
||||||
try (JMXConnector connector = SpringApplicationAdminClient
|
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
|
||||||
.connect(this.jmxPort)) {
|
|
||||||
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
||||||
stop(connection);
|
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 {
|
try {
|
||||||
new SpringApplicationAdminClient(connection, this.jmxName).stop();
|
new SpringApplicationAdminClient(connection, this.jmxName).stop();
|
||||||
}
|
}
|
||||||
catch (InstanceNotFoundException ex) {
|
catch (InstanceNotFoundException ex) {
|
||||||
throw new MojoExecutionException(
|
throw new MojoExecutionException(
|
||||||
"Spring application lifecycle JMX bean not found. Could not stop application gracefully",
|
"Spring application lifecycle JMX bean not found. Could not stop application gracefully", ex);
|
||||||
ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue