- Perform manual synchronization on "BulkImportReport.eventsMultimap", in order to avoid the "ConcurrentModificationException" when requesting a BulkImport-report.

- Prepare app-version for next release.
This commit is contained in:
Lampros Smyrnaios 2024-07-04 01:35:31 +03:00
parent 9e9f417f1f
commit 7a8270c69f
2 changed files with 5 additions and 3 deletions

View File

@ -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
}

View File

@ -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<String, String> eventsMultimap = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.create());
transient private SetMultimap<String, String> 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<String, Collection<String>> eventsMap;
private Map<String, Collection<String>> 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();
}
/**