Class AsynchronousAdministrativeMonitor

java.lang.Object
hudson.model.AbstractModelObject
hudson.model.AdministrativeMonitor
jenkins.management.AsynchronousAdministrativeMonitor
All Implemented Interfaces:
ExtensionPoint, ModelObject, SearchableModelObject, SearchItem, org.kohsuke.stapler.StaplerProxy
Direct Known Subclasses:
RekeySecretAdminMonitor

public abstract class AsynchronousAdministrativeMonitor extends AdministrativeMonitor
Convenient partial implementation of AdministrativeMonitor that involves a background "fixing" action once the user opts in for the execution of it.

A subclass defines what that background fixing actually does in fix(TaskListener). The logging output from it gets persisted, and this class provides a "/log" view that allows the administrator to monitor its progress.

See RekeySecretAdminMonitor for an example of how to subtype this class.

Author:
Kohsuke Kawaguchi
  • Constructor Details

    • AsynchronousAdministrativeMonitor

      public AsynchronousAdministrativeMonitor()
  • Method Details

    • isFixingActive

      public boolean isFixingActive()
      Is there an active execution process going on?
    • getLogText

      public AnnotatedLargeText getLogText()
      Used to URL-bind AnnotatedLargeText.
    • getLogFile

      protected File getLogFile()
      Rewrite log file.
    • getBaseDir

      protected File getBaseDir()
    • getDisplayName

      public abstract String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
      Overrides:
      getDisplayName in class AdministrativeMonitor
    • start

      protected Thread start(boolean forceRestart)
      Starts the background fixing activity.
      Parameters:
      forceRestart - If true, any ongoing fixing activity gets interrupted and the new one starts right away.
    • fix

      protected abstract void fix(TaskListener listener) throws Exception
      Run on a separate thread in the background to fix up stuff.
      Throws:
      Exception