Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
61 views

RejectedExecutionException when using ManagedBlocker in nested parallelStreams

This is a follow-up from this post: Why are inner parallel streams faster with new pools than with the commonPool for this scenario? Apologies in advance for the wall of text. This is for JDK 17. I am ...
Andorrax's user avatar
0 votes
1 answer
78 views

Wrapping Stream.parallel() by Executor service in Java

I'm studying Java Core on course DMDEV in Udemy and YouTube. On Level 2 in lessons Concurrent I probably saw mistake in code the tutor was made. But my question to him was still without response. So ...
jd199's user avatar
  • 1
0 votes
2 answers
34 views

StreamEx groupruns with parallel not working as expected

We have a use case to: Divide a stream into smaller chunks whose size is less than a threshold value and parallelly process the chunks. Our current implementation is like this, where counter is a ...
Datta 's user avatar
  • 31
0 votes
0 answers
98 views

Tomcat catalina.policy file provides security policies to JVM in JDK 21 where Security Manager is deprecated

I have the following JAVA 21 code running within a Tomcat 9 Server where a method is invoked using a CompletableFuture: CompletableFuture.supplyAsync(this::makeHttpCall); The method makeHttpCall ...
Avin's user avatar
  • 59
-1 votes
1 answer
181 views

Can I configure parallelism of ForkJoinPool created for Tomcat in Spring Boot application?

Investigating the issue Spring Boot application gets stuck when virtual threads are used on Java 21 I found out that having virtual threads enabled in Spring Boot application its Tomcat will create ...
Sergey Tsypanov's user avatar
1 vote
1 answer
64 views

All thread blocked in a pool while handling multiple tasklist

I have some problems while using ThreadPoolExecutor and I cannot figure it out. I try to use two List<CompletableFuture<Void>> taskList lists to store tasks and then submit to a threadpool ...
lant's user avatar
  • 514
1 vote
2 answers
886 views

Java 17 Fork join pool limit number of threads in pool

In java 17, we are seeing that a lot more threads are getting created (although not concurrently executing) as compared to older java version (java 8 in my case). While thread itself may not be a huge ...
best wishes's user avatar
  • 6,564
2 votes
0 answers
227 views

How to get access to "ForkJoinPool" that schedules virtual threads

ForkJoinPool.commonPool() returns reference to the common pool which is used for running streams. Is there a way get the reference to access the ForkJoinPool which schedules the virtual threads. ...
Manish Kumar Thakur's user avatar
0 votes
0 answers
105 views

Uneven Load Distribution in Kubernetes Pods with Multithreaded Execution using fork join pool

I have a Spring Boot application where I had a CPU-intensive function performing 43 non-dependent function calls sequentially, resulting in significant execution time. To optimize performance, I ...
Aditya Tiwari's user avatar
-1 votes
1 answer
170 views

How does completablefuture works? [closed]

Need to know the insights of the complete future task without an executor. Here is my sample code CompletableFuture.runAsync(() -> { dosomething(); }); How is this task assigned to the thread? ...
div's user avatar
  • 1
0 votes
1 answer
209 views

stop ForkJoinPool executions when an exception occurs in one task

We have code that walks a tree structure and performs a task for each node. for a leaf node, the task is executed immediately for an inner node (= node with children), the result depends on the ...
geronimo's user avatar
  • 859
2 votes
2 answers
173 views

Memory sharing between Threads

I have a scenario where I am confused little bit. As per my knowledge every thread has some local memory. // 100 elements in SomeArray ArrayList SomeArray = new ArrayList(); ForkJoinPool forkJoinPool ...
Shivansh Bajpai's user avatar
1 vote
2 answers
2k views

Unhandled exception 'java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

We have recently migrated a springboot application to 2.7.11 version, and while performing a load test, a nasty error raised : "Unhandled exception 'java.lang.OutOfMemoryError: unable to create ...
user2676594's user avatar
0 votes
1 answer
77 views

Why ForkJoinTask.join() call rather block the thread instead of stealing the work as expected from work stealing mechanism

I have a recursive task which splits asymmetrically. Instead of splitting in halves it rather bites a pice of work it can execute and forks the rest of work. Such scenario does not get paralleled as ...
Alex Gal's user avatar
2 votes
3 answers
1k views

ExecutorService does not run tasks in parallel

I have a recursive bulk task that I put into execution in a ForkJoinPool thread pool. public class SomeTask extends RecursiveAction { @Override protected void compute() { //Some ...
Kirill's user avatar
  • 33
0 votes
0 answers
42 views

Could ExecutorService prevent Spring RestController from responding to REST calls?

I am trying to figure out why my Microservice A get stuck at a POST call restTemplate.postForEntity whenever that request takes longer than 10-15 minutes and never proceeds further to LOG.info. This ...
valeesi's user avatar
  • 185
2 votes
0 answers
183 views

Generate all partitions of a set in Parallel (java)

I have a list of millions of distinct sets (no two sets have the same values), where I have to find all partitions for every single set. For instance the set {A, B, C} can be partitioned to the ...
CHE's user avatar
  • 41
2 votes
0 answers
187 views

Forkjoin vs Threadpool difference

I am bit confused how Forkjoin internally works vs Thread Pool. Below is the code snippet for the same. Both are having single parallelism. Ideally it should behave same as Thread pool and it should ...
Rahul's user avatar
  • 362
0 votes
0 answers
38 views

How to make a forkjoinpool to compare two Arrays in Java?

So i'm having a problem because i neet to make a recursive void to get the positions of the numbers that are the same but i d'ont know how to make it recursively. i wass wondering if it's possible to ...
Ignasi Ferres's user avatar
1 vote
0 answers
256 views

Scala .PAR Method with ForkJoinPool

I am sure this is due to my inability to fully grasp the concept of .par under the hood, but I am seeing something a bit strange when using it along with a ForkJoinPool. I have an ETL process that ...
Chris Lundeberg's user avatar
4 votes
1 answer
1k views

Why Spring use ForkPoolJoin instead of ThreadPoolTaskExecutor with @Async?

For my studies, I'm working on a Spring Boot REST API. I'm supposed to reduce the execution time of the code when it received a request. So, I thought that make the code asynchronous would be a good ...
EyNimor's user avatar
  • 43
0 votes
1 answer
82 views

The results differ with parallel summation in Java

I made class Sum extends RecursiveTask. The task is to calculate sum of 1 / a[i]. public class Sum extends RecursiveAction { int[] items; double result; int min = 100000; int from, to; ...
GangYeah's user avatar
3 votes
1 answer
1k views

SQS Consumption too slow even with parallalism

I am facing a challenging problem which has blown my head now by trying multiple things so I am here to ask some experts. I have sqs consumer which gets 100k messages every 15 mins and I have a ...
SamD's user avatar
  • 337
0 votes
1 answer
720 views

How to properly see all threads in visualvm

I am trying to learn about heapdumps and threaddumps and in doing that created a very simple application which is using completable future : public static void main(String[] args) throws ...
Akash tiwari's user avatar
4 votes
1 answer
2k views

Java ForkJoinPool hangs in JDK17

The following code works with JDK16 reproducibly and hangs with JDK17 reproducibly on my laptop (4/8-core) with basic command line options: "-ea". A JDK-ticket exists (https://bugs.openjdk....
Uwe's user avatar
  • 85
4 votes
1 answer
930 views

CompletableFuture inside another CompletableFuture doesn't join with timeout

I have one completable future that just runs another completable future(that takes always about 2 seconds and timeout of 50 ms) and waits for it to complete with timeout 1 second. The problem is ...
MediaNik Ok's user avatar
1 vote
1 answer
183 views

ForkJoinPool process Arraylist and return two arrays

i have a huge List<String[]> like about 500k elements validation of it takes too long - 35-40 sec validation looks like this Iterator<String[]>iterator=parser.iterate(request....
JD_UA's user avatar
  • 53
0 votes
1 answer
246 views

ForkPoolTask.join() ConcurrentModificationException

I'm getting a very strange error here that I can't quite understand. As it stands I'm making a crawler program that uses ForkJoinTasks to scan for links on the page and then crawl those as well. ...
WubbaLubbaDubbDubb's user avatar
0 votes
1 answer
420 views

WatchService large number of directory (recursive)

I want to detect changes inside a directory, so I implement by using WatchService public class DirWatcher implements Runnable { private Path path; private ExecutorService exe; public ...
SoT's user avatar
  • 1,203
2 votes
1 answer
726 views

What is the disadvantage of using a ForkJoinPool when it is not needed?

Imagine a scenario where a task can be divided into sub-tasks, each of which does some long running process. Assuming that this heavy task occurs only in 5/100 requests submitted to the server. Would ...
Supersic's user avatar
  • 252
0 votes
0 answers
29 views

Make a parallel process by modifying my original code as little as possible

I have this class: package metodo_java8_moderno; import java.util.ArrayList; import java.util.List; public class SingleThreadClass { public List<Object> editAndAdd(List<List<Long>...
Federico Galimberti's user avatar
0 votes
1 answer
595 views

How to limit number of threads all concurrent methods at once

I am working on a legacy project which uses Java 8, Spring, HikariCP, and MySQL. Microservices' methods are triggered with a Kafka topic and start a reporting operation. Almost all triggered methods ...
oguz's user avatar
  • 1
1 vote
1 answer
216 views

Forkjoinpool VS sequential perofrmance

I am comparing sequential and parallel performance(using ForkJoinPool) of an algorithm(sum of first n numbers): public class ForkJoinSumCalculator extends RecursiveTask<Long> { private ...
Mandroid's user avatar
  • 7,384
0 votes
0 answers
67 views

ForkJoinTask:fork method execution

From Javadoc for ForkJoinTask::fork method: Arranges to asynchronously execute this task in the pool the current task is running in.... So when we invoke fork method on a ForkJoinTask, does it start ...
Mandroid's user avatar
  • 7,384
-1 votes
2 answers
493 views

Level of parallelism of ForkJoinPool.commonPool() [closed]

How do I check the number of threads created by ForkJoinPool.commonPool() in java? Is the degree of parallelism the same as the number of threads created by the commonPool()? How do we create threads ...
Beedle's user avatar
  • 13
1 vote
0 answers
145 views

ForkJoinPool incorrect invokeAll method behavior (java)

ExecutorService have invokeAll method, and documentation say next: Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, ...
Evgeny's user avatar
  • 33
2 votes
1 answer
2k views

ForkJoinPool::shutdown vs ForkJoinPool::shutdownNow after ForkJoinPool::join

Code: final ForkJoinPool forkJoinPool = new ForkJoinPool(PARALLELISM_NUMBER); try { final List<Record> records = getRecrods(); List<...
shantanu's user avatar
  • 2,008
0 votes
0 answers
626 views

perform one transaction for multiple threads

I have a method that persist data before calling multiple threads to perform other actions in parallel: public List<dtos> myMethod(data) repository.saveAll(data); ForkJoinPool pool = new ...
dreamer's user avatar
  • 71
0 votes
1 answer
898 views

Java8 - CompletableFuture - Running methods in async call sequentially

So I have this code block: someMethod(SomeParameter someParameter) { for (SomeObject: object) { if (someObject is true) { callSomeMethod(someParameter); } else { ...
Jet Waitforit Torres's user avatar
0 votes
3 answers
2k views

Behaviour of Threads during blocking IO in Java ForkJoinPool

If the Thread inside the ForkJoinPool does a blocking I/O activity ( simulated below in code using Thread.sleep(10000)) , it should pick up another task which is not causing blocking IO. However, ...
Sunny Bhan's user avatar
0 votes
1 answer
1k views

How to scale? Make Rest API calls thousands times and update database

1. cron job started 2. create Entity1 and save to DB 3. Fetch transactionEntity from DB 4. using transactions as transactionIds. for (Transaction id : transactionIds) { a. create Entity2 ...
Rahul Jaiman's user avatar
1 vote
1 answer
210 views

How does RecursiveAction work with Fibonacci?

How does recursion work in case of Fibonacci. The below example uses RecursiveAction which does not return any value. But still it is possible to calculate Fibonacci numbers. I mean for example in ...
Toni26's user avatar
  • 605
0 votes
1 answer
374 views

Java Completable future thread are alive after method execute

I have written a small program to check behavior of Completable Future. I have not overridden the common pool. I did not found any shut down method and when i print active number of thread at the end, ...
Rahul Kumar's user avatar
0 votes
1 answer
321 views

How to get desired output from ForkJoinPool.commonPool().submit

Please consider the below existing code segment in the project. ForkJoinPool.commonPool().submit(() -> updateActions(a, b, c)); public void updateActions(a, b, c){ --some implementation-- } ...
PGuru's user avatar
  • 27
1 vote
1 answer
2k views

does join of ForkJoinPool block the current thread worker?

I'm trying to run a number of jobs concurrently using Java's ForkJoinPool. The main task (which is already running in the pool) spawns all the jobs and then does a series of joins. I was sure that a ...
Yoav Rodeh's user avatar
1 vote
1 answer
371 views

Actors, ForkJoinPool, and ordering of messages

I need help understanding how an Actor system can use ForkJoinPool and maintain ordering guarantees. I have been playing with Actr https://github.com/zakgof/actr which is a simple small actor system. ...
Christopher Helck's user avatar
1 vote
1 answer
389 views

Whats the benefit to use wrokstealing from ForkJoin rather than just ordinary thread pool's queue?

Whats the benefit to use workstealing from ForkJoin rather than just ordinary thread pool's queue? is the "workstealing" from ForkJoinPool better then just take tasks from the thread pool's ...
linus_tovalds's user avatar
8 votes
1 answer
4k views

Why does Java 17 throw a RejectedExecutionException when adding tasks to a ForkJoinPool?

I used Java 16 to make requests to an API over HTTP. To speed this up overall, I've loaded this onto a custom ForkJoinPool. I've compiled a reproducing example below. Since moving to Java 17 (openjdk ...
TTT's user avatar
  • 6,855
2 votes
1 answer
1k views

Why does a task sometimes run in the main thread although it was submitted to the common ForkJoinPool?

Can someone explain me why some tasks sometimes run in the main thread although they were submitted to the common ForkJoinPool before? Here is an example in Java 16 (adopt-openjdk-16.0.1): import java....
mmirwaldt's user avatar
  • 883
2 votes
1 answer
3k views

Java execute code only after ForkJoinPool submit

I have 1 parallel processing code using ForkJoinPool: ForkJoinPool customThreadPool = new ForkJoinPool(4); customThreadPool.submit(() -> { list.parallelStream().forEach(this::process); }); I ...
user3145373 ツ's user avatar

1
2 3 4 5 6