Skip to content

Commit

Permalink
DSC-1515 allows to configure a sync ExecutorService mainly for testin…
Browse files Browse the repository at this point in the history
…g purpose
  • Loading branch information
abollini committed Jan 28, 2024
1 parent 7af4402 commit 9d5fa13
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dspace-api/src/test/data/dspaceFolder/config/local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
authority.controlled.dspace.object.owner = true

# force the event system to work synchronously during test
system-event.thread.size = 0
12 changes: 12 additions & 0 deletions dspace-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,17 @@
<version>${spring-boot.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<exclusions>
<!-- Use version provided by Solr / Postgres -->
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9d5fa13

Please sign in to comment.