JSP中のMXBeanの使い方
Paste this into a JSP in the ROOT webapp of Tomcat and hit it.
code:
--------------------------------------------------------------------------------
<%@ page import="java.lang.management.*, java.util.*" %><%
response.setContentType("text/plain");
Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator();
while(iter.hasNext()){
MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next();
MemoryUsage mu = item.getUsage();
long used = mu.getUsed();
long committed = mu.getCommitted();
long max = mu.getMax();
%>
MEMORY TYPE: <%=item.getName()%>
Used: <%=used%>
Committed: <%=used%>
Max: <%=max%>
<%}%>
--------------------------------------------------------------------------------
Monitor and manage Java applications with JConsole
0 件のコメント:
コメントを投稿