Skip to content

Commit

Permalink
added option to create a custom number of thread dumps in multiple th…
Browse files Browse the repository at this point in the history
…read dumps

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5592 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 10, 2009
1 parent 6c627db commit e52c3eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 10 additions & 3 deletions htroot/Threaddump_p.html
Expand Up @@ -9,13 +9,20 @@
#%env/templates/header.template%#
#%env/templates/submenuViewLog.template%#
<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>
<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" />
</fieldset>
</form>

</form></td>
</tr></table>

<div>
<tt>#[content]#</tt>
Expand Down
15 changes: 8 additions & 7 deletions htroot/Threaddump_p.java
Expand Up @@ -48,13 +48,11 @@

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) {

prop.clear();
sb = (plasmaSwitchboard) env;

serverObjects prop = new serverObjects();
plasmaSwitchboard sb = (plasmaSwitchboard) env;

final StringBuilder buffer = new StringBuilder(1000);

final boolean plain = post.get("plain", "false").equals("true");
Expand All @@ -74,9 +72,11 @@ public static serverObjects respond(final httpRequestHeader header, final server
bufferappend(buffer, plain, "");
bufferappend(buffer, plain, "");

int multipleCount = 1000;
if (post != null && post.containsKey("multipleThreaddump")) {
multipleCount = post.getInt("count", multipleCount);
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());
}
appendStackTraceStats(sb.getRootPath(), buffer, traces, plain, Thread.State.BLOCKED);
Expand All @@ -98,6 +98,7 @@ public static serverObjects respond(final httpRequestHeader header, final server

bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************");

prop.put("plain_count", multipleCount);
prop.put("plain_content", buffer.toString());
prop.put("plain", (plain) ? 1 : 0);

Expand Down

0 comments on commit e52c3eb

Please sign in to comment.