@@ -35,12 +35,6 @@ ObjectName jvmMetrics = new ObjectName("Hadoop:service=HBase,name=JvmMetrics");
3535
3636// There is always two of GC collectors
3737List<GarbageCollectorMXBean > gcBeans = JSONMetricUtil . getGcCollectorBeans();
38- GarbageCollectorMXBean collector1 = null ;
39- GarbageCollectorMXBean collector2 = null ;
40- try {
41- collector1 = gcBeans. get(0 );
42- collector2 = gcBeans. get(1 );
43- } catch (IndexOutOfBoundsException e) {}
4438List<MemoryPoolMXBean > mPools = JSONMetricUtil . getMemoryPools();
4539pageContext. setAttribute(" pageTitle" , " Process info for PID: " + JSONMetricUtil . getProcessPID());
4640% >
@@ -79,10 +73,10 @@ pageContext.setAttribute("pageTitle", "Process info for PID: " + JSONMetricUtil.
7973 <table class =" table table-striped" width =" 90%" >
8074 <tr >
8175 <th >ThreadsNew</th >
82- <th >ThreadsRunable </th >
76+ <th >ThreadsRunnable </th >
8377 <th >ThreadsBlocked</th >
8478 <th >ThreadsWaiting</th >
85- <th >ThreadsTimeWaiting </th >
79+ <th >ThreadsTimedWaiting </th >
8680 <th >ThreadsTerminated</th >
8781 </tr >
8882 <tr >
@@ -100,55 +94,42 @@ pageContext.setAttribute("pageTitle", "Process info for PID: " + JSONMetricUtil.
10094 <div class =" page-header" >
10195 <h2 >GC Collectors</h2 >
10296 </div >
103- </div >
104- <% if (gcBeans. size() == 2 ) { % >
97+ </div >
98+ <% if (gcBeans != null && ! gcBeans . isEmpty() ) { % >
10599<div class =" tabbable" >
106100 <ul class =" nav nav-pills" role =" tablist" >
101+ <% int idx = 0 ; for (GarbageCollectorMXBean gc : gcBeans) { % >
107102 <li class =" nav-item" >
108- <a class =" nav-link active" href =" #tab_gc1" data-bs-toggle =" tab" role =" tab" ><%= collector1. getName() % > </a >
103+ <a class =" nav-link <%= idx == 0 ? " active" : " " % >" href =" #tab_gc_<%= idx % >" data-bs-toggle =" tab" role =" tab" >
104+ <%= gc. getName() % >
105+ </a >
109106 </li >
110- <li class =" nav-item" >
111- <a class =" nav-link" href =" #tab_gc2" data-bs-toggle =" tab" role =" tab" ><%= collector2. getName() % > </a >
112- </li >
107+ <% idx++ ; } % >
113108 </ul >
114109 <div class =" tab-content" >
115- <div class =" tab-pane active" id =" tab_gc1" role =" tabpanel" >
110+ <% idx = 0 ; long totalGcTime = 0 ; for (GarbageCollectorMXBean gc : gcBeans) { totalGcTime += gc. getCollectionTime(); % >
111+ <div class =" tab-pane <%= idx == 0 ? " active" : " " % >" id =" tab_gc_<%= idx % >" role =" tabpanel" >
116112 <table class =" table table-striped" >
117113 <tr >
118114 <th >Collection Count</th >
119115 <th >Collection Time</th >
120116 <th >Last duration</th >
121117 </tr >
122118 <tr >
123- <td > <%= collector1 . getCollectionCount() % > </td >
124- <td > <%= StringUtils . humanTimeDiff(collector1 . getCollectionTime()) % > </td >
125- <td > <%= StringUtils . humanTimeDiff(JSONMetricUtil . getLastGcDuration(
126- collector1 . getObjectName())) % > </td >
119+ <td ><%= gc . getCollectionCount() % > </td >
120+ <td ><%= StringUtils . humanTimeDiff(gc . getCollectionTime()) % > </td >
121+ <td ><%= StringUtils . humanTimeDiff(JSONMetricUtil . getLastGcDuration(
122+ gc . getObjectName())) % > </td >
127123 </tr >
128124 </table >
129125 </div >
130- <div class =" tab-pane" id =" tab_gc2" role =" tabpanel" >
131- <table class =" table table-striped" >
132- <tr >
133- <th >Collection Count</th >
134- <th >Collection Time</th >
135- <th >Last duration</th >
136- </tr >
137- <tr >
138- <td > <%= collector2. getCollectionCount() % > </td >
139- <td > <%= StringUtils . humanTimeDiff(collector2. getCollectionTime()) % > </td >
140- <td > <%= StringUtils . humanTimeDiff(JSONMetricUtil . getLastGcDuration(
141- collector2. getObjectName())) % > </td >
142- </tr >
143- </table >
144- </div >
126+ <% idx++ ; } % >
145127 </div >
146128 </div >
147- <% } else { % >
148- <p > Can not display GC Collector stats.</p >
149- <% } % >
150- Total GC Collection time: <%= StringUtils . humanTimeDiff(collector1. getCollectionTime() +
151- collector2. getCollectionTime()) % >
129+ <p >Total GC Collection time: <%= StringUtils . humanTimeDiff(totalGcTime) % > </p >
130+ <% } else { % >
131+ <p >Can not display GC Collector stats.</p >
132+ <% } % >
152133</div >
153134<% for (MemoryPoolMXBean mp: mPools) {
154135if (mp. getName(). contains(" Cache" )) continue ;% >
0 commit comments