avoid long hang on jmx connection problems while checking for non-boot live beans mbean

This commit is contained in:
Martin Lippert
2019-01-24 10:57:33 +01:00
parent 2ab97b332d
commit d01a3a4abb

View File

@@ -235,11 +235,11 @@ public abstract class AbstractSpringBootApp implements SpringBootApp {
protected Set<ObjectName> getNonBootSpringLiveMBeans() {
if (this.nonBootLiveMBeanNames == null) {
try {
this.nonBootLiveMBeanNames = withJmxConnector(jmxConnector -> {
this.nonBootLiveMBeanNames = withTimeout(() -> withJmxConnector(jmxConnector -> {
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
QueryExp queryExp = Query.isInstanceOf(Query.value("org.springframework.context.support.LiveBeansView"));
return connection.queryNames(null, queryExp);
});
}));
} catch (Exception e) {
e.printStackTrace();
this.nonBootLiveMBeanNames = Collections.emptySet();