Package io.jenkins.plugins.armorcode
Class ArmorCodeJobDiscovery
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
hudson.model.AsyncPeriodicWork
io.jenkins.plugins.armorcode.ArmorCodeJobDiscovery
- All Implemented Interfaces:
ExtensionPoint,Runnable
Periodic background task that discovers Jenkins jobs and sends their data to ArmorCode.
The task runs every minute and checks if the current time matches the configured cron expression.
This approach prevents multiple timers from running when the cron configuration changes.
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.triggers.SafeTimerTask
SafeTimerTask.ExceptionRunnableNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.model.AsyncPeriodicWork
nameFields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecute(TaskListener listener) Executes the periodic task with better error handling and logging.longReturns a fixed recurrence period of 1 minute.Methods inherited from class hudson.model.AsyncPeriodicWork
createListener, doRun, getErrorLoggingLevel, getLogFile, getNormalLoggingLevel, getSlowLoggingLevelMethods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, initMethods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, runMethods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
ArmorCodeJobDiscovery
public ArmorCodeJobDiscovery()Constructor with name for the background task.
-
-
Method Details
-
getRecurrencePeriod
public long getRecurrencePeriod()Returns a fixed recurrence period of 1 minute. The actual execution logic in execute() checks if monitoring is enabled and if the cron expression matches the current time. Note: This method is only called once at startup by AsyncPeriodicWork.- Specified by:
getRecurrencePeriodin classPeriodicWork
-
execute
Executes the periodic task with better error handling and logging. This is called by Jenkins' AsyncPeriodicWork framework every minute. It checks if the current time matches the cron expression before executing.- Specified by:
executein classAsyncPeriodicWork
-