2006-12-12 17:24:47 -05:00
|
|
|
<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
|
2006-11-09 18:13:58 -05:00
|
|
|
<%--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
--%>
|
2007-12-06 22:49:52 -05:00
|
|
|
<%@ page import="org.apache.solr.core.SolrCore,
|
|
|
|
java.lang.management.ManagementFactory,
|
2006-05-02 13:38:11 -04:00
|
|
|
java.lang.management.ThreadMXBean,
|
|
|
|
java.lang.management.ThreadInfo,
|
2006-12-12 17:24:47 -05:00
|
|
|
java.io.IOException,
|
2008-07-15 17:30:37 -04:00
|
|
|
org.apache.solr.common.util.XML"%>
|
2008-03-25 21:39:01 -04:00
|
|
|
<%@include file="_info.jsp" %>
|
|
|
|
|
2006-12-12 17:24:47 -05:00
|
|
|
|
|
|
|
<?xml-stylesheet type="text/xsl" href="threaddump.xsl"?>
|
2006-05-02 13:38:11 -04:00
|
|
|
<%!
|
|
|
|
static ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
|
2006-01-26 00:37:29 -05:00
|
|
|
%>
|
2006-12-12 17:24:47 -05:00
|
|
|
<solr>
|
2008-03-25 21:39:01 -04:00
|
|
|
<core><%= collectionName %></core>
|
2006-12-12 17:24:47 -05:00
|
|
|
<system>
|
|
|
|
<jvm>
|
|
|
|
<version><%=System.getProperty("java.vm.version")%></version>
|
|
|
|
<name><%=System.getProperty("java.vm.name")%></name>
|
|
|
|
</jvm>
|
|
|
|
<threadCount>
|
|
|
|
<current><%=tmbean.getThreadCount()%></current>
|
|
|
|
<peak><%=tmbean.getPeakThreadCount()%></peak>
|
|
|
|
<daemon><%=tmbean.getDaemonThreadCount()%></daemon>
|
|
|
|
</threadCount>
|
2006-05-02 13:38:11 -04:00
|
|
|
<%
|
|
|
|
long[] tids;
|
|
|
|
ThreadInfo[] tinfos;
|
|
|
|
tids = tmbean.findMonitorDeadlockedThreads();
|
2006-12-12 17:24:47 -05:00
|
|
|
if (tids != null) {
|
|
|
|
out.println(" <deadlocks>");
|
2006-05-02 13:38:11 -04:00
|
|
|
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
|
|
|
|
for (ThreadInfo ti : tinfos) {
|
|
|
|
printThreadInfo(ti, out);
|
|
|
|
}
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" </deadlocks>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
|
|
|
%>
|
|
|
|
<%
|
|
|
|
tids = tmbean.getAllThreadIds();
|
|
|
|
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <threadDump>");
|
2006-05-02 13:38:11 -04:00
|
|
|
for (ThreadInfo ti : tinfos) {
|
|
|
|
printThreadInfo(ti, out);
|
|
|
|
}
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" </threadDump>");
|
2006-05-02 13:38:11 -04:00
|
|
|
%>
|
2006-12-12 17:24:47 -05:00
|
|
|
</system>
|
|
|
|
</solr>
|
2006-05-02 13:38:11 -04:00
|
|
|
|
|
|
|
<%!
|
|
|
|
static void printThreadInfo(ThreadInfo ti, JspWriter out) throws IOException {
|
|
|
|
long tid = ti.getThreadId();
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <thread>");
|
|
|
|
out.println(" <id>" + tid + "</id>");
|
|
|
|
out.print(" <name>");
|
|
|
|
XML.escapeCharData(ti.getThreadName(), out);
|
|
|
|
out.println("</name>");
|
|
|
|
out.println(" <state>" + ti.getThreadState() + "</state>");
|
2006-05-02 13:38:11 -04:00
|
|
|
if (ti.getLockName() != null) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <lock>" + ti.getLockName() + "</lock>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
|
|
|
if (ti.isSuspended()) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <suspended/>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
|
|
|
if (ti.isInNative()) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <inNative/>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
|
|
|
if (tmbean.isThreadCpuTimeSupported()) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <cpuTime>" + formatNanos(tmbean.getThreadCpuTime(tid)) + "</cpuTime>");
|
|
|
|
out.println(" <userTime>" + formatNanos(tmbean.getThreadUserTime(tid)) + "</userTime>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
2006-12-12 17:24:47 -05:00
|
|
|
|
2006-05-02 13:38:11 -04:00
|
|
|
if (ti.getLockOwnerName() != null) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <owner>");
|
|
|
|
out.println(" <name>" + ti.getLockOwnerName() + "</name>");
|
|
|
|
out.println(" <id>" + ti.getLockOwnerId() + "</id>");
|
|
|
|
out.println(" </owner>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" <stackTrace>");
|
2006-05-02 13:38:11 -04:00
|
|
|
for (StackTraceElement ste : ti.getStackTrace()) {
|
2006-12-12 17:24:47 -05:00
|
|
|
out.print(" <line>");
|
|
|
|
XML.escapeCharData("at " + ste.toString(), out);
|
|
|
|
out.println(" </line>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
2006-12-12 17:24:47 -05:00
|
|
|
out.println(" </stackTrace>");
|
|
|
|
out.println(" </thread>");
|
2006-05-02 13:38:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static String formatNanos(long ns) {
|
|
|
|
return String.format("%.4fms", ns / (double) 1000000);
|
|
|
|
}
|
|
|
|
%>
|