added option to create a custom number of thread dumps in multiple thread dumps

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5592 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 6c627dbdff
commit e52c3eb79d

@ -9,13 +9,20 @@
#%env/templates/header.template%# #%env/templates/header.template%#
#%env/templates/submenuViewLog.template%# #%env/templates/submenuViewLog.template%#
<h2>Threaddump</h2> <h2>Threaddump</h2>
<form action="Threaddump_p.html" method="get" > <table border="0" cellpadding="0" cellspacing="0"><tr>
<td><form action="Threaddump_p.html" method="get" >
<fieldset> <fieldset>
<input type="submit" name="singleThreaddump" value="Single Threaddump" /> <input type="submit" name="singleThreaddump" value="Single Threaddump" />
</fieldset>
</form></td>
<td><form action="Threaddump_p.html" method="get" >
<fieldset>
<input type="text" name="count" value="#[count]#" size="4" maxlength="4" />
<input type="submit" name="multipleThreaddump" value="Multiple Dump Statistic" /> <input type="submit" name="multipleThreaddump" value="Multiple Dump Statistic" />
</fieldset> </fieldset>
</form> </form></td>
</tr></table>
<div> <div>
<tt>#[content]#</tt> <tt>#[content]#</tt>

@ -48,13 +48,11 @@ import de.anomic.yacy.yacyVersion;
public class Threaddump_p { public class Threaddump_p {
private static final serverObjects prop = new serverObjects();
private static plasmaSwitchboard sb = null;
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) { public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
prop.clear(); serverObjects prop = new serverObjects();
sb = (plasmaSwitchboard) env; plasmaSwitchboard sb = (plasmaSwitchboard) env;
final StringBuilder buffer = new StringBuilder(1000); final StringBuilder buffer = new StringBuilder(1000);
final boolean plain = post.get("plain", "false").equals("true"); final boolean plain = post.get("plain", "false").equals("true");
@ -74,9 +72,11 @@ public class Threaddump_p {
bufferappend(buffer, plain, ""); bufferappend(buffer, plain, "");
bufferappend(buffer, plain, ""); bufferappend(buffer, plain, "");
int multipleCount = 1000;
if (post != null && post.containsKey("multipleThreaddump")) { if (post != null && post.containsKey("multipleThreaddump")) {
multipleCount = post.getInt("count", multipleCount);
final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<Map<Thread,StackTraceElement[]>>(); final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<Map<Thread,StackTraceElement[]>>();
for (int i = 0; i < 1000; i++) { for (int i = 0; i < multipleCount; i++) {
traces.add(Thread.getAllStackTraces()); traces.add(Thread.getAllStackTraces());
} }
appendStackTraceStats(sb.getRootPath(), buffer, traces, plain, Thread.State.BLOCKED); appendStackTraceStats(sb.getRootPath(), buffer, traces, plain, Thread.State.BLOCKED);
@ -98,6 +98,7 @@ public class Threaddump_p {
bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************"); bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************");
prop.put("plain_count", multipleCount);
prop.put("plain_content", buffer.toString()); prop.put("plain_content", buffer.toString());
prop.put("plain", (plain) ? 1 : 0); prop.put("plain", (plain) ? 1 : 0);

Loading…
Cancel
Save