Class DefaultOAuth2AuthorizedClientEntityCleanupServices

java.lang.Object
com.broadleafcommerce.auth.client.service.DefaultOAuth2AuthorizedClientEntityCleanupServices

public class DefaultOAuth2AuthorizedClientEntityCleanupServices extends Object

A camel cluster service instance that will periodically cleanup OAuth2AuthorizedClientEntity in the datastore. getPause() is used to determine the amount of time to wait between cleanup runs. The pause is used as a measure to throttle database activity resulting from cleaning up. The batch size is also involved in throttling the effect of this cleanup service by controlling the count of items checked for expiration.

Note, because this is a cluster service, only one instance will run in the cluster at a time. If an instance of auth service goes down, another instance of DefaultOAuth2AuthorizedClientEntityCleanupServices will start to maintain a consistent count of 1 instance in the cluster.

See Also:
  • Field Details

    • started

      protected boolean started
      Whether this service has been started and is actively scheduling tasks.
  • Constructor Details

  • Method Details

    • start

      public void start()
      Starts the cleanup process by scheduling the first task for now.
    • stop

      public void stop()
      Stops the cleanup process by cancelling all scheduled tasks.
    • cleanup

      protected void cleanup()
    • getPause

      protected int getPause()
      Returns:
      the seconds to pause between the current execution of a batch and the next. This is not necessarily deterministic and can be random (within a range)
    • buildCleanupRequest

      protected OAuth2AuthorizedClientEntityCleanupRequest buildCleanupRequest(@Nullable OAuth2AuthorizedClientEntityCleanupResponse lastResponse)
    • getCleanupProperties

      protected OAuth2AuthorizedClientCleanupProperties getCleanupProperties()
      Properties configuring cleanup behavior.
    • getOAuth2AuthorizedClientEntityService

      protected OAuth2AuthorizedClientEntityService<OAuth2AuthorizedClientEntity> getOAuth2AuthorizedClientEntityService()
      The entity service to which CRUD calls will be delegated.
    • getScheduler

      protected org.springframework.scheduling.TaskScheduler getScheduler()
      The scheduler used to queue tasks. This should typically be a single-thread ThreadPoolTaskScheduler.
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getRandom

      protected Random getRandom()
      Used to add a bit of randomness in intervals between cleanup jobs.
    • isStarted

      public boolean isStarted()
      Whether this service has been started and is actively scheduling tasks.
    • getScheduledTasks

      protected List<ScheduledFuture<?>> getScheduledTasks()
      The tasks that have been scheduled by this service.
    • getLastEndingResponse

      @Nullable protected OAuth2AuthorizedClientEntityCleanupResponse getLastEndingResponse()
      Contains the response received from the last execution of cleanup() (if executed). Used to prepare the next request.