Skip to main content
3 votes
0 answers
58 views

ExecutorService - cancel pending tasks

There are multiple questions about waiting for an Java ExecutorService to finish (shutdown() + awaitTermination()) or alternatively cancel them all (shutdownNow()). I'd like to go for an early exit ...
queeg's user avatar
  • 9,334
0 votes
0 answers
38 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 : ...
Muddassir Rahman's user avatar
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)...
Jahnvi Tanwar's user avatar
0 votes
0 answers
48 views

An approach to avoid OOM issue for parallel tasks

I have written a program which basically reads a file, processes its records to extract some data using a third party library and then dispatches the data to a remote server. To speed up the process, ...
Mandroid's user avatar
  • 7,412
0 votes
0 answers
54 views

How do I handle and prevent race conditions in a multi-threaded Java application using ExecutorService? [duplicate]

I'm building a multi-threaded Java application where I need to run several tasks concurrently using ExecutorService. However, I'm encountering issues with race conditions when multiple threads try to ...
Harini Ramkarthik's user avatar
1 vote
1 answer
56 views

Interrupting a thread that's running a CompletableFuture [duplicate]

Consider I have an ExecutorService operating on top of a pool of daemon threads (so that I don't need to explicitly shut it down): final var executor = Executors.newFixedThreadPool( Runtime....
Bass's user avatar
  • 5,276
1 vote
0 answers
22 views

IllegalArgumentException when processing shapefile with worldwind using executor service

I am using NASA worldwind library to process a shapefile. When my code is single threaded all works fine. But when I add parallel processing with executor service to speed up things, I start getting ...
Mandroid's user avatar
  • 7,412
3 votes
1 answer
273 views

How to limit number of virtual threads to avoid large number of DB connections?

I am currently using Executors.newFixedThreadPool to run a large number of tasks in parallel. try(ExecutorService executorService = Executors.newFixedThreadPool(10)) { List<Future<...
Mandroid's user avatar
  • 7,412
0 votes
2 answers
74 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(...
pixel's user avatar
  • 26.4k
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> ...
Srinivas Rao's user avatar
0 votes
2 answers
98 views

Creating tasks in another task in Java

I wrote a function that submits tasks to ExecutorService. This function has a condition if it's true function will call itself to create another task. private void taskCreator(int v, ExecutorService ...
dezzwwi's user avatar
1 vote
1 answer
46 views

How Can I delete Comet Executor.exe from AppData\Romaing\Comet Executor?

My friend's 11yrs old son visited at home with family and let him use my desktop. This generation kids are genius with computer, and installed cloud based game program called Comet Executor. It hidden ...
Justine Win's user avatar
-1 votes
1 answer
57 views

Unexpected working of CopyOnWriteArrayList with newScheduledThreadPool

Creating a multi-threaded program to calculate the factorial of a no using ExecutorService. Here is the code: package org.example.executorsExample; // example of how to use Callable and ...
Cody's user avatar
  • 2,649
0 votes
0 answers
41 views

Stop when one future task has completed in java

I have 2 FutureTask Objects. My tasks are running parallelly. However, What I want is that as soon as one of the FutureTask method completes its execution/job the other should stop. But inside method(...
user_apr's user avatar
  • 747
0 votes
0 answers
67 views

ExecutorService awaitTermination does not wait for threads to complete and terminates main thread immediately

I have created a ExecutorService having 3 threads using which I'm trying to process a list each having 2MM objects. I'm calling below 2 methods after submitting the 3 tasks. executorService.shutdown();...
Darshan Dagly's user avatar

15 30 50 per page
1
2 3 4 5
156