Skip to content
Snippets Groups Projects
Commit 45fc7560 authored by George Tziavas's avatar George Tziavas
Browse files

added synchronized to JobService methods

parent feaeaef3
No related branches found
No related tags found
1 merge request!8Draft: 8-make-metrico-use-the-tmf-api-databse-tables
Pipeline #12939 failed
......@@ -43,7 +43,7 @@ public class JobService {
* @throws IllegalArgumentException if the job's start or end date is invalid
* @throws RejectedExecutionException if the job could not be scheduled
*/
public Job startJob(Runnable task, Job job) {
public synchronized Job startJob(Runnable task, Job job) {
logger.debug("Starting Job for MeasurementCollectionJob with ID {}.", job.getMeasurementCollectionJobRef());
MeasurementCollectionJobMVO mcjMVO = new MeasurementCollectionJobMVO();
......@@ -89,7 +89,7 @@ public class JobService {
*
* @param job the job to be stopped
*/
public void stopJob(Job job) {
public synchronized void stopJob(Job job) {
MeasurementCollectionJobMVO mcjMVO = new MeasurementCollectionJobMVO();
......@@ -128,7 +128,7 @@ public class JobService {
*
* @param measurementCollectionJobUuid the UUID of the Measurement Collection Job
*/
public void stopJob(String measurementCollectionJobUuid) {
public synchronized void stopJob(String measurementCollectionJobUuid) {
Job job = runningJobs.get(measurementCollectionJobUuid);
if (job != null) {
stopJob(job);
......@@ -142,7 +142,7 @@ public class JobService {
*
* <p>This method iterates over all jobs in the runningJobs map, stops each job, and then clears the map.</p>
*/
public void stopAllJobs() {
public synchronized void stopAllJobs() {
for (Job job : runningJobs.values()) {
stopJob(job);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment