Class CredentialMonitorScheduler

java.lang.Object
se.swedenconnect.security.credential.spring.autoconfigure.CredentialMonitorScheduler
All Implemented Interfaces:
Lifecycle, Phased, SmartLifecycle

public class CredentialMonitorScheduler extends Object implements SmartLifecycle
Schedules a CredentialMonitorBean to run periodically. If a TaskScheduler is supplied, it is used, otherwise a dedicated single-thread scheduler is created (and shut down when the application stops). This means that the application does not need to enable Spring scheduling for credential monitoring to work.
Author:
Martin Lindström
  • Constructor Details

    • CredentialMonitorScheduler

      public CredentialMonitorScheduler(@Nonnull CredentialMonitorBean monitorBean, @Nonnull Duration testInterval, @Nullable TaskScheduler taskScheduler)
      Constructor.
      Parameters:
      monitorBean - the monitor to run
      testInterval - the delay between test runs
      taskScheduler - the scheduler to use, or null for a dedicated scheduler
  • Method Details

    • start

      public void start()
      Schedules the monitor task.
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Cancels the monitor task, and shuts down the dedicated scheduler if one was created.
      Specified by:
      stop in interface Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle