11package com .samourai .javaserver .web .models ;
22
3+ import com .samourai .javaserver .utils .ServerUtils ;
34import java .util .Collection ;
4- import java .util .Comparator ;
5- import java .util .stream .Collectors ;
5+ import java .util .Map ;
66import org .springframework .ui .Model ;
77
88public class SystemTemplateModel extends DashboardTemplateModel {
99 public Collection <Thread > threads ;
1010 public long memUsed ;
1111 public long memTotal ;
1212 public long startupTime ;
13+ public Map <String , String > metrics ;
1314
14- public SystemTemplateModel (String pageTitle , String logoTitle ) {
15+ public SystemTemplateModel (String pageTitle , String logoTitle , Map < String , String > metrics ) {
1516 super (pageTitle , logoTitle );
1617
17- ThreadGroup tg = Thread .currentThread ().getThreadGroup ();
18- this .threads =
19- Thread .getAllStackTraces ()
20- .keySet ()
21- .stream ()
22- .filter (t -> t .getThreadGroup () == tg )
23- .sorted (Comparator .comparing (o -> o .getName ().toLowerCase ()))
24- .collect (Collectors .toList ());
18+ this .threads = ServerUtils .getInstance ().getThreads ();
2519 if (false ) { // template usage
2620 Thread t = threads .iterator ().next ();
2721 t .getName ();
@@ -34,6 +28,8 @@ public SystemTemplateModel(String pageTitle, String logoTitle) {
3428 long free = rt .freeMemory ();
3529 memUsed = bytesToMB (total - free );
3630 memTotal = bytesToMB (total );
31+
32+ this .metrics = metrics ;
3733 }
3834
3935 public void setStartupTime (long startupTime ) {
0 commit comments