Class HealthServiceImpl

  • All Implemented Interfaces:
    HealthService, ej.kf.FeatureStateListener

    public class HealthServiceImpl
    extends java.lang.Object
    implements HealthService, ej.kf.FeatureStateListener
    • Constructor Summary

      Constructors 
      Constructor Description
      HealthServiceImpl​(ej.bon.Timer timer, long intervalMS, boolean runGcBeforeCollecting)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getFreeMemory()  
      long getMaxMemory()  
      long getTotalMemory()  
      ej.basictool.map.PackedMap<java.lang.String,​java.lang.Float> getUsedCpuPercentPerModule()
      Retrieves the CPU usage for each module from the previous monitoring cycle, expressed as a percentage.
      ej.basictool.map.PackedMap<java.lang.String,​java.lang.Float> getUsedMemoryPercentPerModule()
      Retrieves the RAM usage values expressed as a percentage (a value between 0 and 1.0).
      ej.basictool.map.PackedMap<java.lang.String,​java.lang.Long> getUsedMemoryPerModule()
      Retrieves the current RAM usage for each module.
      void start()  
      void stateChanged​(ej.kf.Feature app, ej.kf.Feature.State state)  
      void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HealthServiceImpl

        public HealthServiceImpl​(ej.bon.Timer timer,
                                 long intervalMS,
                                 boolean runGcBeforeCollecting)
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • stateChanged

        public void stateChanged​(ej.kf.Feature app,
                                 @Nullable
                                 ej.kf.Feature.State state)
        Specified by:
        stateChanged in interface ej.kf.FeatureStateListener
      • getUsedCpuPercentPerModule

        public ej.basictool.map.PackedMap<java.lang.String,​java.lang.Float> getUsedCpuPercentPerModule()
        Description copied from interface: HealthService
        Retrieves the CPU usage for each module from the previous monitoring cycle, expressed as a percentage.
        Specified by:
        getUsedCpuPercentPerModule in interface HealthService
        Returns:
        A map where each entry contains a module name as the key and its CPU usage percentage (0.0 to 1.0) as the value.
      • getUsedMemoryPerModule

        public ej.basictool.map.PackedMap<java.lang.String,​java.lang.Long> getUsedMemoryPerModule()
        Description copied from interface: HealthService
        Retrieves the current RAM usage for each module.
        Specified by:
        getUsedMemoryPerModule in interface HealthService
        Returns:
        A map where each entry contains a module identifier as the key and its current RAM usage in bytes as the value.
      • getUsedMemoryPercentPerModule

        public ej.basictool.map.PackedMap<java.lang.String,​java.lang.Float> getUsedMemoryPercentPerModule()
        Description copied from interface: HealthService
        Retrieves the RAM usage values expressed as a percentage (a value between 0 and 1.0).

        The percentage indicates the ratio between a module's current heap consumption and the total heap.

        Specified by:
        getUsedMemoryPercentPerModule in interface HealthService
        Returns:
        A map where each entry contains the module name as the key and its current RAM usage percentage as the value.
      • getMaxMemory

        public long getMaxMemory()
        Specified by:
        getMaxMemory in interface HealthService
        Returns:
        return max memory