Package com.logicaldoc.core.system
Class SystemLoadMonitor
- java.lang.Object
-
- com.logicaldoc.core.system.SystemLoadMonitor
-
public class SystemLoadMonitor extends Object
This class monitors the system load and notifies the listeners accordingly- Since:
- 6.7.1
- Author:
- Marco Meschieri - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description SystemLoadMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(SystemLoadListener listener)int[]getAverageCpuLoad()Gets the average CPU load computed in the last two minutes:
first value: the 'average cpu usage' for the whole system second value: the 'average cpu usage' for the JVM processint[]getCpuLoad()Retrieve the CPU load:
first value: the 'recent cpu usage' for the whole system second value: the 'recent cpu usage' for the JVM processbooleanisAverageCpuOverLoaded()Check if the 'average' CPU load is over the limit defined in 'system.cpuload.max' config parameter.booleanisCpuOverLoaded()Check if the 'recent' CPU load is over the limit defined in 'load.cpumax' config parameter.voidremoveListener(SystemLoadListener listener)voidsetConfig(ContextProperties config)voidsetSamplesTotal(int samplesTotal)voidstart()voidstop()
-
-
-
Method Detail
-
setConfig
public void setConfig(ContextProperties config)
-
setSamplesTotal
public void setSamplesTotal(int samplesTotal)
-
addListener
public void addListener(SystemLoadListener listener)
-
removeListener
public void removeListener(SystemLoadListener listener)
-
getAverageCpuLoad
public int[] getAverageCpuLoad()
Gets the average CPU load computed in the last two minutes:
- first value: the 'average cpu usage' for the whole system
- second value: the 'average cpu usage' for the JVM process
- Returns:
- average CPU load infos
-
isCpuOverLoaded
public boolean isCpuOverLoaded()
Check if the 'recent' CPU load is over the limit defined in 'load.cpumax' config parameter.- Returns:
- if the CPU is overloaded
-
getCpuLoad
public int[] getCpuLoad()
Retrieve the CPU load:
- first value: the 'recent cpu usage' for the whole system
- second value: the 'recent cpu usage' for the JVM process
- Returns:
- current CPU load infos
-
isAverageCpuOverLoaded
public boolean isAverageCpuOverLoaded()
Check if the 'average' CPU load is over the limit defined in 'system.cpuload.max' config parameter.- Returns:
- if the CPU is overloaded
-
stop
public void stop()
-
start
public void start()
-
-