Class PeriodicService

java.lang.Object
com.cloudbees.sdk.extensibility.lifecycle.PeriodicService
All Implemented Interfaces:
Startable

public abstract class PeriodicService extends Object implements Startable
Base implementation for components that run periodical background task.
Author:
Kohsuke Kawaguchi
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Run from the web interface.
    protected long
    Initial delay in milliseconds to run the first execution, in milliseconds.
    protected abstract long
    Cycle of execution, in milliseconds.
    protected abstract void
    run()
    Executes the periodic task.
    void
    Called once right after the Guice world is started, to provide an opportunity to start various objects.

    Methods inherited from class java.lang.Object

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

    • PeriodicService

      public PeriodicService()
  • Method Details

    • start

      public void start() throws Exception
      Description copied from interface: Startable
      Called once right after the Guice world is started, to provide an opportunity to start various objects.

      Exceptions thrown will terminate the system.

      Specified by:
      start in interface Startable
      Throws:
      Exception
    • run

      protected abstract void run() throws Exception
      Executes the periodic task.
      Throws:
      Exception
    • doRun

      public void doRun() throws Exception
      Run from the web interface.
      Throws:
      Exception
    • getPeriod

      protected abstract long getPeriod()
      Cycle of execution, in milliseconds.
    • getInitialDelay

      protected long getInitialDelay()
      Initial delay in milliseconds to run the first execution, in milliseconds.