diff --git a/build.gradle b/build.gradle index 5d53800..540d704 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { java { group = 'eu.openaire.urls_controller' - version = '2.8.0' + version = '2.8.1-SNAPSHOT' sourceCompatibility = JavaVersion.VERSION_1_8 } diff --git a/src/main/java/eu/openaire/urls_controller/models/BulkImportReport.java b/src/main/java/eu/openaire/urls_controller/models/BulkImportReport.java index ccc80d8..b9b8d0e 100644 --- a/src/main/java/eu/openaire/urls_controller/models/BulkImportReport.java +++ b/src/main/java/eu/openaire/urls_controller/models/BulkImportReport.java @@ -34,12 +34,12 @@ public class BulkImportReport { private String reportID; // This will not be serialized, since Gson cannot serialize Multimaps. Instead, it will be converted to the "simpler" map below. - transient private SetMultimap eventsMultimap = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.create()); + transient private SetMultimap eventsMultimap = LinkedHashMultimap.create(); // We need a "LinkedHashMultimap", se that the order of the keys (timestamps) stay ascending, so the final report makes sense in chronological order. // We need for one key (timestamp) to have multiple values (events), in order to not lose events happening at the same time. @JsonProperty - private Map> eventsMap; + private Map> eventsMap = null; transient private final Lock reportLock = new ReentrantLock(true); @@ -52,7 +52,9 @@ public class BulkImportReport { public void addEvent(String event) { + reportLock.lock(); eventsMultimap.put(GenericUtils.getReadableCurrentTimeAndZone(), event); // This is synchronized. + reportLock.unlock(); } /**