[bs-87] Add /dump endpoint

* Just dumps ThreadInfo, simple but effective
* Implementation is part of TraceEndpoint

[Fixes #49056831]
pull/1/merge
Dave Syer 12 years ago
parent a968b140cc
commit cee78386ee

@ -45,6 +45,9 @@ public class EndpointsProperties {
@Valid @Valid
private Endpoint trace = new Endpoint("/trace"); private Endpoint trace = new Endpoint("/trace");
@Valid
private Endpoint dump = new Endpoint("/dump");
public Endpoint getVarz() { public Endpoint getVarz() {
return this.varz; return this.varz;
} }
@ -65,6 +68,10 @@ public class EndpointsProperties {
return this.trace; return this.trace;
} }
public Endpoint getDump() {
return this.dump;
}
public static class Endpoint { public static class Endpoint {
@NotNull @NotNull

@ -16,6 +16,9 @@
package org.springframework.bootstrap.service.trace; package org.springframework.bootstrap.service.trace;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -44,4 +47,11 @@ public class TraceEndpoint {
return this.tracer.traces(); return this.tracer.traces();
} }
@RequestMapping("${endpoints.dump.path:/dump}")
@ResponseBody
public List<ThreadInfo> dump() {
return Arrays.asList(ManagementFactory.getThreadMXBean().dumpAllThreads(true,
true));
}
} }

Loading…
Cancel
Save