火曜日, 11月 18, 2008

JSP中のMXBeanの使い方

Using the Platform MBean Server and Platform MXBeans - Java SE Monitoring and Management Guide

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
  1. Part 1 ー Localの設定
  2. Part 2 ー Remoteの設定

0 件のコメント: