diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/JobQueueManagerHelper.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/JobQueueManagerHelper.java index bf52c785de57..3abfb75d30c9 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/JobQueueManagerHelper.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/JobQueueManagerHelper.java @@ -11,27 +11,53 @@ import javax.inject.Inject; import java.lang.reflect.Constructor; import java.util.List; +import java.util.Objects; +/** + * Helper class for managing job queue processors in the JobQueueManagerAPI. + * This class is responsible for discovering job processors, registering them with + * the JobQueueManagerAPI, and shutting down the JobQueueManagerAPI when needed. + *
+ * It utilizes the {@link JobProcessorScanner} to discover available job processors + * and the {@link JobQueueManagerAPI} to register them for processing jobs in the queue. + *
+ * The class is annotated with {@link ApplicationScoped} to indicate that it is
+ * a singleton managed by the CDI container.
+ */
@ApplicationScoped
public class JobQueueManagerHelper {
private JobProcessorScanner scanner;
+ /**
+ * Constructor that injects the {@link JobProcessorScanner} instance.
+ *
+ * @param scanner The JobProcessorScanner to discover job processors
+ */
@Inject
public JobQueueManagerHelper(final JobProcessorScanner scanner) {
this.scanner = scanner;
}
+ /**
+ * Default constructor required by CDI.
+ */
public JobQueueManagerHelper() {
- // Default constructor required by CDI
}
+ /**
+ * Registers all discovered job processors with the provided JobQueueManagerAPI.
+ * If the JobQueueManagerAPI is not started, it starts the API before registering the processors.
+ *
+ * @param jobQueueManagerAPI The JobQueueManagerAPI instance to register processors with
+ */
public void registerProcessors(final JobQueueManagerAPI jobQueueManagerAPI) {
if (!jobQueueManagerAPI.isStarted()) {
jobQueueManagerAPI.start();
Logger.info(this.getClass(), "JobQueueManagerAPI started");
}
+ // Discover job processors and attempt to register them
List