initial steps to keep checking manual configs on demand
This commit is contained in:
@@ -143,39 +143,58 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
}
|
||||
|
||||
public class RemoteBootAppData {
|
||||
|
||||
private String jmxurl;
|
||||
private String host;
|
||||
private String urlScheme = "https";
|
||||
private String port = "443";
|
||||
private boolean keepChecking = false;
|
||||
|
||||
public RemoteBootAppData(String jmxurl, String host) {
|
||||
super();
|
||||
this.jmxurl = jmxurl;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getJmxurl() {
|
||||
return jmxurl;
|
||||
}
|
||||
|
||||
public void setJmxurl(String jmxurl) {
|
||||
this.jmxurl = jmxurl;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getUrlScheme() {
|
||||
return urlScheme;
|
||||
}
|
||||
|
||||
public void setUrlScheme(String urlScheme) {
|
||||
this.urlScheme = urlScheme;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public boolean isKeepChecking() {
|
||||
return keepChecking;
|
||||
}
|
||||
|
||||
public void setKeepChecking(boolean keepChecking) {
|
||||
this.keepChecking = keepChecking;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendConfiguration() {
|
||||
|
||||
@@ -281,7 +281,7 @@ public abstract class AbstractSpringBootApp implements SpringBootApp {
|
||||
return hasJmxBeans != null ? hasJmxBeans : false;
|
||||
}
|
||||
|
||||
private boolean containsSpringJmxBeans() throws Exception {
|
||||
protected boolean containsSpringJmxBeans() throws Exception {
|
||||
return withTimeout(TIMEOUT_CHECKFORSPRINGAPPS, () -> withJmxConnector(jmxConnector -> {
|
||||
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
|
||||
|
||||
|
||||
@@ -20,20 +20,23 @@ import org.springframework.ide.vscode.commons.util.MemoizingProxy;
|
||||
|
||||
public class RemoteSpringBootApp extends AbstractSpringBootApp {
|
||||
|
||||
private String jmxUrl;
|
||||
private String host = null;
|
||||
private String port = "443";
|
||||
private String urlScheme = "https";
|
||||
private final String jmxUrl;
|
||||
private final String host;
|
||||
private final String port;
|
||||
private final String urlScheme;
|
||||
private boolean keepChecking;
|
||||
|
||||
protected RemoteSpringBootApp(String jmxUrl, String host, String port, String urlScheme) {
|
||||
public static SpringBootApp create(String jmxUrl, String host, String port, String urlScheme, boolean keepChecking) {
|
||||
return MemoizingProxy.create(RemoteSpringBootApp.class, Duration.ofMillis(4900), new Class[] {String.class, String.class, String.class, String.class, boolean.class},
|
||||
jmxUrl, host, port, urlScheme, keepChecking);
|
||||
}
|
||||
|
||||
protected RemoteSpringBootApp(String jmxUrl, String host, String port, String urlScheme, boolean keepChecking) {
|
||||
this.jmxUrl = jmxUrl;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.urlScheme = urlScheme;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
this.keepChecking = keepChecking;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,18 +97,26 @@ public class RemoteSpringBootApp extends AbstractSpringBootApp {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public static SpringBootApp create(String jmxUrl, String host, String port, String urlScheme) {
|
||||
return MemoizingProxy.create(RemoteSpringBootApp.class, Duration.ofMillis(4900), new Class[] {String.class, String.class, String.class, String.class},
|
||||
jmxUrl, host, port, urlScheme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrlScheme() {
|
||||
return urlScheme;
|
||||
}
|
||||
|
||||
public void setUrlScheme(String urlScheme) {
|
||||
this.urlScheme = urlScheme;
|
||||
@Override
|
||||
public boolean hasUsefulJmxBeans() {
|
||||
if (keepChecking) {
|
||||
try {
|
||||
logger.info("checking for spring jmx beans, continuously trying -- " + this.toString());
|
||||
return super.containsSpringJmxBeans();
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.info("no spring jmx beans found, continuously trying -- " + this.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return super.hasUsefulJmxBeans();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,50 +30,71 @@ import org.springframework.ide.vscode.commons.util.CollectorUtil;
|
||||
public class RemoteRunningAppsProvider implements RunningAppProvider {
|
||||
|
||||
public static class RemoteBootAppData {
|
||||
|
||||
private String jmxurl;
|
||||
private String host;
|
||||
private String urlScheme = "https";
|
||||
private String port = "443";
|
||||
private boolean keepChecking = false;
|
||||
|
||||
public String getJmxurl() {
|
||||
return jmxurl;
|
||||
}
|
||||
|
||||
public void setJmxurl(String jmxurl) {
|
||||
this.jmxurl = jmxurl;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getUrlScheme() {
|
||||
return urlScheme;
|
||||
}
|
||||
|
||||
public void setUrlScheme(String urlScheme) {
|
||||
this.urlScheme = urlScheme;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public boolean isKeepChecking() {
|
||||
return keepChecking;
|
||||
}
|
||||
|
||||
public void setKeepChecking(boolean keepChecking) {
|
||||
this.keepChecking = keepChecking;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RemoteBootAppData [jmxurl=" + jmxurl + ", host=" + host + ", urlScheme=" + urlScheme + ", port="
|
||||
+ port + "]";
|
||||
+ port + ", keepChecking=" + keepChecking + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((host == null) ? 0 : host.hashCode());
|
||||
result = prime * result + ((jmxurl == null) ? 0 : jmxurl.hashCode());
|
||||
result = prime * result + (keepChecking ? 1231 : 1237);
|
||||
result = prime * result + ((port == null) ? 0 : port.hashCode());
|
||||
result = prime * result + ((urlScheme == null) ? 0 : urlScheme.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
@@ -93,6 +114,8 @@ public class RemoteRunningAppsProvider implements RunningAppProvider {
|
||||
return false;
|
||||
} else if (!jmxurl.equals(other.jmxurl))
|
||||
return false;
|
||||
if (keepChecking != other.keepChecking)
|
||||
return false;
|
||||
if (port == null) {
|
||||
if (other.port != null)
|
||||
return false;
|
||||
@@ -105,6 +128,7 @@ public class RemoteRunningAppsProvider implements RunningAppProvider {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(RemoteRunningAppsProvider.class);
|
||||
@@ -149,7 +173,7 @@ public class RemoteRunningAppsProvider implements RunningAppProvider {
|
||||
for (RemoteBootAppData key : newAppData) {
|
||||
remoteAppInstances.computeIfAbsent(key, (_key) -> {
|
||||
logger.info("Creating RemoteStringBootApp: "+_key);
|
||||
return RemoteSpringBootApp.create(key.getJmxurl(), key.getHost(), key.getPort(), key.getUrlScheme());
|
||||
return RemoteSpringBootApp.create(key.getJmxurl(), key.getHost(), key.getPort(), key.getUrlScheme(), key.isKeepChecking());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user