All Questions
Tagged with javamultithreading
124 questions
1vote
1answer
77views
Handling order Id In OMS system on application level [closed]
Situation: Order Handling in OMS System: In my OMS system, orders are pushed from an online platform with a unique orderId. Since the orderId is generated by the online platform, I cannot make it auto-...
0votes
1answer
494views
Global Variables State Management
Background: I am working in a Java environment using Spring Boot, where I often encounter scenarios where global variable state management is critical, especially within singleton services. I have ...
0votes
1answer
120views
In Java's Fork/Join is the operation for combining results limited to addition?
As I understand it, the join() method merge/composes/combines the results from all subtasks. A simple example I saw was summing the numbers from 1 to N and the subtasks would simply sum a range of ...
1vote
1answer
128views
Non blocking algorithm for invalidating and reloading cache in concurrent environment using Redis (with Redisson)
I'm trying to come up with a peace of code that would fetch centralised cache shared across multiple threads/app instances. Callers might come in swarms. The data is a large set, reads during ...
1vote
4answers
4kviews
Multithreaded processing of single REST requests
Background: We're providing an API that provides information about all users within a given group. Our API is a high level facade over another low-level REST API. To gather those information we first ...
0votes
0answers
1kviews
How does Spring boot and Postgres handle the concurrent updates?
I want to understand how does Spring Boot and Postgresql DB handle the concurrent requests for updating a value in DB. Consider this example of facebook likes, if there are multiple instances of ...
-1votes
2answers
262views
Do I really need TaskManager class? [duplicate]
Background: I'm coding an app, the core idea is simple - I can choose a 'Task' (consists of name, code to perform aka Runnable, progress) through GUI, start it, stop it, start all 'Task's and stop all ...
1vote
1answer
837views
Shared mutable object in Multithreading
I have a class like this. (My actual class is different. I am using this to explain the problem). This class instance is shared between 2 threads. However those 2 threads (thread1 and thread2), call ...
1vote
1answer
488views
java threading model for scale up
I need some advice on the scale-up issue. we have a java application currently it works as below the current system is using the Thread Per Request Model. each client connection (long-running and ...
-3votes
1answer
80views
Will this time duration measurement in two threads give correct result?
A program I'm developing has two threads running similar but different task: thread1: timer1.start() writeToExternalDB1(consumedData) timer1.end() thread2: timer2.start() writeToExternalDB2(...
2votes
0answers
107views
Why does the Java CompletableFuture API uses long + TimeUnit instead of Duration?
Java 9 introduced many new methods in the CompletableFuture API that support execution timeouts. For example: public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit); public ...
2votes
1answer
102views
Effective thread usage under blocking scenario
I have the following scenario: I am listening file requests and when one arrives, I am starting download task in a new thread. After download task ends, a process task starts but this is important, ...
1vote
2answers
1kviews
RxJava and race conditions
I have seen some RxJava projects using multithreading with .subscribeOn(Schedulers.io()), and their .subscribe(() -> {...}) code is manipulating some data structures that are also processed by ...
-2votes
2answers
3kviews
Generating unique numeric ids in multiple thread application without locking
Multi Threaded application with n threads implemented using ExecutorService. There are x (tens of millions) tasks submitted to the ExecutorService. Each task needs to generate millions (number of ...
1vote
2answers
476views
Multiple thread invocation in Rest Web Service
I have a scenario in our Web Application. GUI invokes a REST web wervice and further web service calls a procedure. However, the procedure returns data properly for most of the scenarios. In some ...