日期:2014-05-17 浏览次数:20765 次
<html>
02 <head>
03 <title>Threads in ldcstudy.com</title>
04 <style>
05 body {font-size:8pt;}
06 ol {line-height:18px;}
07 </style>
08 </head>
09 <body>
10 <strong>java.io.tmpdir:</strong>
11 <ul>
12 <li><%=System.getProperty("java.io.tmpdir")%></li>
13 </ul>
14 <br/>
15 <strong>Memory:</strong>
16 <ol>
17 <li>freeMemory=<%=Runtime.getRuntime().freeMemory()/(1024*1024)%>M</li>
18 <li>totalMemory=<%=Runtime.getRuntime().totalMemory()/(1024*1024)%>M</li>
19 <li>maxMemory=<%=Runtime.getRuntime().maxMemory()/(1024*1024)%>M</li>
20 </ol>
21 <br/>
22 <strong>Thread:</strong>
23 <ol>
24 <%for(Thread t : list_threads()){%>
25 <li><%=t.getName()%>(<b><%=t.getState()%></b>) : <%=t.getClass().getName()%></li>
26 <%}%>
27 </ol>
28 <%!
29 public static java.util.List<Thread> list_threads(){
30 int tc = Thread.activeCount();
31 Thread[] ts = new Thread[tc];
32 Thread.enumerate(ts);
33 return java.util.Arrays.asList(ts);
34 }
35 %>
36 </body>
37 </html>