%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
<%--
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.
--%>
<%@ page import="org.apache.solr.core.SolrCore,
java.lang.management.ManagementFactory,
java.lang.management.ThreadMXBean,
java.lang.management.ThreadInfo,
java.io.IOException,
org.apache.solr.common.util.XML"%>
<%@include file="_info.jsp" %>
<%!
static ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
%>
<%= collectionName %>
<%=System.getProperty("java.vm.version")%>
<%=System.getProperty("java.vm.name")%>
<%=tmbean.getThreadCount()%>
<%=tmbean.getPeakThreadCount()%>
<%=tmbean.getDaemonThreadCount()%>
<%
long[] tids;
ThreadInfo[] tinfos;
tids = tmbean.findMonitorDeadlockedThreads();
if (tids != null) {
out.println(" ");
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
for (ThreadInfo ti : tinfos) {
printThreadInfo(ti, out);
}
out.println(" ");
}
%>
<%
tids = tmbean.getAllThreadIds();
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
out.println(" ");
for (ThreadInfo ti : tinfos) {
printThreadInfo(ti, out);
}
out.println(" ");
%>
<%!
static void printThreadInfo(ThreadInfo ti, JspWriter out) throws IOException {
long tid = ti.getThreadId();
out.println(" ");
out.println(" " + tid + "");
out.print(" ");
XML.escapeCharData(ti.getThreadName(), out);
out.println("");
out.println(" " + ti.getThreadState() + "");
if (ti.getLockName() != null) {
out.println(" " + ti.getLockName() + "");
}
if (ti.isSuspended()) {
out.println(" ");
}
if (ti.isInNative()) {
out.println(" ");
}
if (tmbean.isThreadCpuTimeSupported()) {
out.println(" " + formatNanos(tmbean.getThreadCpuTime(tid)) + "");
out.println(" " + formatNanos(tmbean.getThreadUserTime(tid)) + "");
}
if (ti.getLockOwnerName() != null) {
out.println(" ");
out.println(" " + ti.getLockOwnerName() + "");
out.println(" " + ti.getLockOwnerId() + "");
out.println(" ");
}
out.println(" ");
for (StackTraceElement ste : ti.getStackTrace()) {
out.print(" ");
XML.escapeCharData("at " + ste.toString(), out);
out.println(" ");
}
out.println(" ");
out.println(" ");
}
static String formatNanos(long ns) {
return String.format("%.4fms", ns / (double) 1000000);
}
%>