Package edu.byu.hbll.box.internal.core
Class QueueRunner
- java.lang.Object
-
- edu.byu.hbll.box.internal.core.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 Summary
Constructors Constructor Description QueueRunner(Registry registry, SourceConfig source, OnOffSemaphore onOffSemaphore)
Creates a newQueueRunner
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
preDestroy()
Called when the application is undeployed to allow the client to cleanup resources.void
submit(String id, Instant attempt, boolean resetAttempt)
Submits a document ID for future asynchronous processing.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.byu.hbll.box.BoxConfigurable
postConstruct, postInit
-
-
-
-
Constructor Detail
-
QueueRunner
public QueueRunner(Registry registry, SourceConfig source, OnOffSemaphore onOffSemaphore)
Creates a newQueueRunner
.- Parameters:
registry
- the registrysource
- the source for this runneronOffSemaphore
- 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 processedattempt
- when to attempt processingresetAttempt
- 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 interfaceBoxConfigurable
-
-