PT #151428541: first steps to gather live hover hint data from running apps

This commit is contained in:
Martin Lippert
2017-10-02 16:30:33 +02:00
parent 0d75bd4b56
commit 7c4c3f50f5
7 changed files with 348 additions and 63 deletions

View File

@@ -55,6 +55,22 @@ public class SpringBootApp {
return result;
}
/**
* @return Map that contains the boot apps, mapping the process ID -> boot app accessor object
*/
public static Map<String, SpringBootApp> getAllRunningSpringApps() throws Exception {
Map<String, SpringBootApp> result = new HashMap<>();
List<VirtualMachineDescriptor> list = VirtualMachine.list();
for (VirtualMachineDescriptor vmd : list) {
SpringBootApp app = new SpringBootApp(vmd);
if (app.isSpringBootApp()) {
result.put(app.getProcessID(), app);
}
}
return result;
}
public SpringBootApp(VirtualMachineDescriptor vmd) throws Exception {
this.vmd = vmd;
this.vm = VirtualMachine.attach(vmd);
@@ -76,6 +92,16 @@ public class SpringBootApp {
return contains(cpElements, "spring-boot");
}
public boolean containsSystemProperty(Object key) {
try {
Properties props = this.vm.getSystemProperties();
return props.containsKey(key);
}
catch (Exception e) {
return false;
}
}
public String getPort() throws Exception {
String jmxConnect = this.vm.startLocalManagementAgent();