Class UnstartedPeriodicTaskComponent

All Implemented Interfaces:
NBComponent, NBComponentAdvisors, NBComponentEvents, NBComponentMetrics, NBComponentProps, NBComponentServices, NBComponentTimeline, NBProviderSearch, NBTokenWords, NBLabeledElement, AutoCloseable, Runnable
Direct Known Subclasses:
ComponentPulse, PeriodicTaskComponent

public abstract class UnstartedPeriodicTaskComponent extends NBBaseComponent implements Runnable

Because of ctor super calling order requirements, the task thread can't always be started automatically in super(...). If that is the case, then use this class directly and call start() at the end of your subtype ctor.

Otherwise, it is safe to use PeriodicTaskComponent directly.

  • Field Details

    • intervalmillis

      protected final long intervalmillis
  • Constructor Details

  • Method Details

    • start

      public void start()
    • task

      protected abstract void task()
      This task should only do what is needed once each period. If it throws any exceptions, then these exceptions will cause the period task to exit. Thus, if you need to allow failures in some cases while keeping the caller (scheduler) active, all errors should be caught and handled internally.
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • teardown

      public void teardown()
      Description copied from class: NBBaseComponent
      Override this method in your component implementations when you need to do something to close out your component.
      Overrides:
      teardown in class NBBaseComponent