Class SystemLoadMonitor
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
hudson.model.AsyncPeriodicWork
io.jenkins.plugins.smartexecutorloadbalancer.SystemLoadMonitor
- All Implemented Interfaces:
ExtensionPoint, Runnable
Periodically polls the 1-minute system load average from every online node
via the remoting channel and caches the result in memory.
SmartLoadBalancer reads this cache synchronously during scheduling
so there is no per-schedule I/O.
On Windows agents, getSystemLoadAverage() returns -1 (unsupported).
We treat -1 as 0.0 so Windows nodes are not penalised.
-
Nested Class Summary
Nested classes/interfaces inherited from class SafeTimerTask
SafeTimerTask.ExceptionRunnableNested classes/interfaces inherited from interface ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class AsyncPeriodicWork
nameFields inherited from class PeriodicWork
DAY, HOUR, logger, MIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecute(TaskListener listener) static doubleReturns the cached load average for the named computer.longMethods inherited from class AsyncPeriodicWork
createListener, doRun, getErrorLoggingLevel, getLogFile, getNormalLoggingLevel, getSlowLoggingLevel, queueIfAlreadyRunningMethods inherited from class PeriodicWork
all, getInitialDelay, initMethods inherited from class SafeTimerTask
getLogsRoot, of, runMethods inherited from class TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
SystemLoadMonitor
public SystemLoadMonitor()
-
-
Method Details
-
getRecurrencePeriod
public long getRecurrencePeriod()- Specified by:
getRecurrencePeriodin classPeriodicWork
-
execute
- Specified by:
executein classAsyncPeriodicWork- Throws:
IOExceptionInterruptedException
-
getLoad
Returns the cached load average for the named computer. Falls back to 0.0 if no measurement has been taken yet or polling failed.
-