Author: nextgens
Date: 2006-10-29 17:06:24 +0000 (Sun, 29 Oct 2006)
New Revision: 10737

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
Add a "generate a thread dump" button on the /statistic/ page

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-29 17:06:15 UTC (rev 10736)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-29 17:06:24 UTC (rev 10737)
@@ -94,6 +94,14 @@
                long now = System.currentTimeMillis();

                contentNode.addChild(core.alerts.createSummary());
+
+               // Generate a Thread-Dump
+               if(node.isUsingWrapper()){
+                       HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("Request a Thread Dump to be 
generated"));
+                       // Yes, we want it to be a GET so that we can use 
external tools to trigger it.
+                       HTMLNode threadDumpForm = 
ctx.getPageMaker().getContentNode(infobox).addChild("form", new String[] { 
"action", "method" }, new String[] { "/", "GET" });
+                       threadDumpForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "getThreadDump", "Generate a Thread 
Dump" });
+               }

                double swaps = (double)node.getSwaps();
                double noSwaps = (double)node.getNoSwaps();
@@ -429,8 +437,6 @@
             }
                }

-               StringBuffer pageBuffer = new StringBuffer();
-               pageNode.generate(pageBuffer);
-               this.writeReply(ctx, 200, "text/html", "OK", 
pageBuffer.toString());
+               this.writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
        }
 }


Reply via email to