Execute the "AssignmentHandler.handleAssignment()", only from the scheduler, as it starts automatically when the program starts.
This commit is contained in:
parent
5f3409e072
commit
3550ed71d9
|
@ -1,6 +1,6 @@
|
||||||
package eu.openaire.urls_worker;
|
package eu.openaire.urls_worker;
|
||||||
|
|
||||||
import eu.openaire.urls_worker.util.AssignmentHandler;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
@ -12,8 +12,6 @@ public class UrlsWorkerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(UrlsWorkerApplication.class, args);
|
SpringApplication.run(UrlsWorkerApplication.class, args);
|
||||||
|
|
||||||
AssignmentHandler.handleAssignment();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class AssignmentHandler {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AssignmentHandler.class);
|
private static final Logger logger = LoggerFactory.getLogger(AssignmentHandler.class);
|
||||||
|
|
||||||
public static boolean isAvailableForWork = false;
|
public static boolean isAvailableForWork = true;
|
||||||
|
|
||||||
public static Assignment requestAssignment()
|
public static Assignment requestAssignment()
|
||||||
{
|
{
|
||||||
|
@ -65,6 +65,8 @@ public class AssignmentHandler {
|
||||||
logger.warn("The assignment was found to be null!");
|
logger.warn("The assignment was found to be null!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start handling the assignment, the worker is busy.
|
||||||
isAvailableForWork = false;
|
isAvailableForWork = false;
|
||||||
|
|
||||||
List<Task> tasks = assignment.getTasks();
|
List<Task> tasks = assignment.getTasks();
|
||||||
|
|
Loading…
Reference in New Issue