diff --git a/dspace-api/src/test/data/dspaceFolder/config/local.cfg b/dspace-api/src/test/data/dspaceFolder/config/local.cfg
index 3618d405f7f2..2f3a64218dbf 100644
--- a/dspace-api/src/test/data/dspaceFolder/config/local.cfg
+++ b/dspace-api/src/test/data/dspaceFolder/config/local.cfg
@@ -223,4 +223,7 @@ orcid.synchronization-enabled = true
# These settings ensure "dspace.object.owner" field are indexed by Authority Control
choices.plugin.dspace.object.owner = EPersonAuthority
choices.presentation.dspace.object.owner = suggest
-authority.controlled.dspace.object.owner = true
\ No newline at end of file
+authority.controlled.dspace.object.owner = true
+
+# force the event system to work synchronously during test
+system-event.thread.size = 0
\ No newline at end of file
diff --git a/dspace-services/pom.xml b/dspace-services/pom.xml
index 867ac1dc1a7e..39e2ccf36f38 100644
--- a/dspace-services/pom.xml
+++ b/dspace-services/pom.xml
@@ -154,5 +154,17 @@
${spring-boot.version}
+
+ com.google.guava
+ guava
+
+
+
+ org.checkerframework
+ checker-qual
+
+
+
+
diff --git a/dspace-services/src/main/java/org/dspace/services/events/SystemEventService.java b/dspace-services/src/main/java/org/dspace/services/events/SystemEventService.java
index 5a4f118fcdc3..322b0dc8be20 100644
--- a/dspace-services/src/main/java/org/dspace/services/events/SystemEventService.java
+++ b/dspace-services/src/main/java/org/dspace/services/events/SystemEventService.java
@@ -15,6 +15,7 @@
import java.util.function.Supplier;
import javax.annotation.PreDestroy;
+import com.google.common.util.concurrent.MoreExecutors;
import org.apache.commons.lang3.ArrayUtils;
import org.dspace.services.ConfigurationService;
import org.dspace.services.EventService;
@@ -107,7 +108,11 @@ private void initExecutor() {
}
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
int threadSize = configurationService.getIntProperty("system-event.thread.size", DEFAULT_THREAD_SIZE);
- this.executorService = Executors.newFixedThreadPool(threadSize);
+ if (threadSize == 0) {
+ this.executorService = MoreExecutors.newDirectExecutorService();
+ } else {
+ this.executorService = Executors.newFixedThreadPool(threadSize);
+ }
}
/* (non-Javadoc)