Class QueueRunner

  • All Implemented Interfaces:
    BoxConfigurable

    public class QueueRunner
    extends Object
    implements BoxConfigurable
    A single background thread that processes tasks from all maintenance queues. It runs according to a specified schedule. The schedule is a cron like schedule that kicks off the run of maintenance. The run will only execute for the supplied
    Author:
    Charles Draper
    • Constructor Detail

      • QueueRunner

        public QueueRunner​(Registry registry,
                           SourceConfig source,
                           OnOffSemaphore onOffSemaphore)
        Creates a new QueueRunner.
        Parameters:
        registry - the registry
        source - the source for this runner
        onOffSemaphore - the on off semaphore
    • Method Detail

      • submit

        public void submit​(String id,
                           Instant attempt,
                           boolean resetAttempt)
        Submits a document ID for future asynchronous processing. The ID is first queued in memory before being written to disk so this method is very fast.
        Parameters:
        id - the document ID to be processed
        attempt - when to attempt processing
        resetAttempt - if the ID is already in the queue, this will reset its attempt time to now if true, otherwise it will leave it as it is.
      • preDestroy

        public void preDestroy()
        Description copied from interface: BoxConfigurable
        Called when the application is undeployed to allow the client to cleanup resources. Default is to do nothing.
        Specified by:
        preDestroy in interface BoxConfigurable