All Questions
Tagged with executorservice spring-boot
71 questions
0
votes
0
answers
39
views
Why Threadpool queue the task instead of reusing the idle threads
Creation of ThreadPool
@PostConstruct
public void postConstruct() {
threadPool = new ThreadPoolExecutor(corePoolSize != 0 ? corePoolSize : defaultPoolSize, maxPoolSize != 0 ? maxPoolSize : ...
0
votes
1
answer
31
views
Can the threads handling api requests and used in multithreading inside the request belong to same thread pool, in springboot?
I have built a SpringBoot application with REST APIs, One of these multithreaded APIs is implemented using executor service.
ExecutorService service = Executors.newFixedThreadPool(threadPoolSize)...
0
votes
2
answers
75
views
Server Sent Events in Spring - why executor service is used there?
I wonder why SseEmitter events are sent inside the executor in most tutorials.
SseEmitter emitter = new SseEmitter();
ExecutorService sseMvcExecutor = Executors.newSingleThreadExecutor(...
0
votes
0
answers
66
views
Async execution of stored procedure hangs
I have an Async method in Spring boot that executes stored procedure in Oracle
@Autowired
EntityManager entityManager;
@Async ("taskExecutor")
public CompletableFuture<ResultObject> ...
-1
votes
1
answer
65
views
Concurrency thread not responding back
I'm trying to execute the below code for concurrency but the concurrency threads are never responding back. Please find the below pseudo-code, after creating the 10 parallel threads and the control is ...
0
votes
0
answers
56
views
Create New thread for sub task using completablefuture
I have a problem,
On Service class i have a @async method which call three method using CF,
Service 1 Method 1 t1
Service 2 Method 2 t2
Service 3 Method 3 t3
In method 1 I have complex logic around ...
0
votes
0
answers
185
views
java.lang.reflect.InaccessibleObjectException: Unable to make field private final while submitting task to executor service after JDK 17 upgrade
We upgraded our application to springboot 3.1.4 from springboot 2.5.4 and JDK from 1.8 to 17.
We get the java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util....
0
votes
0
answers
184
views
Problem in accessing a bean having request scope need in worker thread
I have a rest controller when call comes to it main thread submit the request to the worker thread using executor service, in my code I have one bean which is of request based lets call it Hello
In my ...
0
votes
1
answer
381
views
How to stop the ExecutorService when I find something
I am using Java 21 and Spring Boot 3.2.0 (SNAPSHOT). I have more classes, but I show only the essential classes for this case. I am trying to check some records in a multithreading environment using ...
0
votes
1
answer
332
views
Best way to use ExecutorService in case we need to handle timeout for each thread individually
Below is my my code implementation using ExecutorService
public void startDownloading(DownloadInfo downloadInfo) {
int messageSentToNextQueue = 0;
ExecutorService downloadExecutor = ...
0
votes
1
answer
44
views
best practice to know how may threads are running
I have a SOAP Services environement implemented using SpringBoot 1.5.8 & Java 8 that do some stuff, some of that are parallelized via ExecutorService for each request. The information that we need ...
0
votes
1
answer
341
views
Sprint-Boot Application does not end when using a HttpClient with sendAsync with a newFixedThreadPool
When using a HttpClient (java.net.http.HttpClient) to do some GET requests I want to use a FixedThreadPool.
Therefore I wrote a spring-boot application with this method (for testing it):
public class ...
0
votes
1
answer
2k
views
How many thread Pools are allowed to be created?
I have a Spring Boot application in which everytime API call is made, I am creating an ExecutorService with fixedThreadPool size of 5 threads and passing around 500 tasks to CompletableFuture to run ...
0
votes
1
answer
1k
views
How can I unit test Java Executor service?
I have created ExecutorService bean and injected it as dependency, to close it I have copied code from Official website, and wrote jUnit to call method directly, but now it shows coverage for first ...
0
votes
0
answers
189
views
Executor Service with Multipartfile problem in Springboot
I want to forward a list of Multipart File from service1 to service2. It looks like below:
Client -> Service1 -> Service2
In Service1: I use Executor Service to send the files
@RestController
@...