diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/storage/ReportStorageServiceAsyncWrapper.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/storage/ReportStorageServiceAsyncWrapper.java index 05efea1..19419a7 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/storage/ReportStorageServiceAsyncWrapper.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/storage/ReportStorageServiceAsyncWrapper.java @@ -1,9 +1,8 @@ package com.iqser.red.service.redaction.report.v1.server.storage; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; +import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import lombok.RequiredArgsConstructor; @@ -16,10 +15,12 @@ import lombok.RequiredArgsConstructor; public class ReportStorageServiceAsyncWrapper { private final ReportStorageService reportStorageService; - private final Executor ioExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + private final TaskExecutor taskExecutor; public CompletableFuture storeObjectAsync(String downloadId, byte[] data) { - return CompletableFuture.supplyAsync(() -> reportStorageService.storeObject(downloadId, data), ioExecutor); + + return CompletableFuture.supplyAsync(() -> reportStorageService.storeObject(downloadId, data), taskExecutor); } + }