Skip to content
Snippets Groups Projects
Commit b2494cbf authored by gmantele's avatar gmantele
Browse files

[UWS] Make the list of jobs concurrent (i.e. Thread safe).

_This commit aims to fix the issue #47_
parent fe4c3e97
No related branches found
No related tags found
No related merge requests found
...@@ -22,9 +22,9 @@ package uws.job; ...@@ -22,9 +22,9 @@ package uws.job;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import uws.UWSException; import uws.UWSException;
import uws.UWSExceptionFactory; import uws.UWSExceptionFactory;
...@@ -181,8 +181,8 @@ public class JobList extends SerializableUWSObject implements Iterable<UWSJob> { ...@@ -181,8 +181,8 @@ public class JobList extends SerializableUWSObject implements Iterable<UWSJob> {
} }
name = jobListName; name = jobListName;
jobsList = new LinkedHashMap<String,UWSJob>(); jobsList = new ConcurrentHashMap<String,UWSJob>();
ownerJobs = new LinkedHashMap<JobOwner,Map<String,UWSJob>>(); ownerJobs = new ConcurrentHashMap<JobOwner,Map<String,UWSJob>>();
this.executionManager = executionManager; this.executionManager = executionManager;
...@@ -543,7 +543,7 @@ public class JobList extends SerializableUWSObject implements Iterable<UWSJob> { ...@@ -543,7 +543,7 @@ public class JobList extends SerializableUWSObject implements Iterable<UWSJob> {
if (owner != null){ if (owner != null){
// Index also this job in function of its owner: // Index also this job in function of its owner:
if (!ownerJobs.containsKey(owner)) if (!ownerJobs.containsKey(owner))
ownerJobs.put(owner, new LinkedHashMap<String,UWSJob>()); ownerJobs.put(owner, new ConcurrentHashMap<String,UWSJob>());
ownerJobs.get(owner).put(j.getJobId(), j); ownerJobs.get(owner).put(j.getJobId(), j);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment