Skip to main content
0 votes
1 answer
103 views

In my code (Java 17) I am used to handle exceptions from combined CompletableFutures with get() like this: try { CompletableFuture.allOf(someFuture, someOtherFuture).get(); } catch (...
thevasssa's user avatar
1 vote
1 answer
63 views

This is a piece of test code with POI. It reads an Excel file as a template to write data and saves it locally. This code will eventually be executed under a web application, meaning it will be ...
Jolyou Lu's user avatar
4 votes
2 answers
264 views

I noticed hundreds and thousands of threads running while debugging my javafx MediaPlayer application in Netbeans. So I went to this simple demo code, ran it in the debugger, and again saw hundreds of ...
Evgeny's user avatar
  • 121
-1 votes
3 answers
166 views

I’m learning about multithreading in Java, and I have a specific question regarding how to safely stop a thread. I know that the stop() method is deprecated and unsafe because it can leave objects in ...
ENNER OSVALDO GODOY RAMIREZ's user avatar
-1 votes
2 answers
110 views

I have four services that post four types of transactions to a remote server, which allows only 14 concurrent requests at a time. Since Service A and Service B process a high volume of data, they each ...
Themisba7's user avatar
1 vote
1 answer
165 views

I am trying to apply a synchronized block with locks from some old tutorials. The app takes 2 seconds on tutorial, but mine has 4 seconds because of the Thread.sleep(1) part. I don't know why 1ms ...
mohamedesam's user avatar
-1 votes
1 answer
123 views

I am trying to implement a custom HashMap for multithreading environment. Why is this giving inconsistent results? I think multiple threads are accessing the put method simultaneously. class Main{ ...
A7781's user avatar
  • 1
4 votes
1 answer
661 views

I wanted to try power of virtual threads in Java in a simple application which consists of many tasks. Each task executes a query agains a database which takes around 10 seconds. My expectation was ...
CodeGrinder's user avatar
0 votes
2 answers
121 views

Can this code ever lead to missed signal? If yes, then how? private Object lock = new Object(); private boolean conditionMet = false; public void waitForCondition() throws InterruptedException { ...
user1918858's user avatar
  • 1,228
1 vote
2 answers
136 views

Is there some API in the Java standard library with which from within a JVM some Java code can be executed that lists all OS threads of the host OS the JVM is running on? In particular, I don't want ...
OlliP's user avatar
  • 1,607
0 votes
1 answer
159 views

public class TestJUC { private int x; public void actor1(){ x = 1; } public void actor2() { System.out.println(x); } } If thread A executes actor1 method and ...
qwee's user avatar
  • 29
0 votes
1 answer
92 views

I am developing a small JavFXML desktop application that includes a TaskWorker. The objective is to run the task worker when a button is clicked, but nothing happens and the taskworker is not called. ...
Rusty's user avatar
  • 169
1 vote
1 answer
63 views

I need help solving this problem which I have, so if anyone had a similar problem, that will help me a lot. The problem is related to concurrent programming in Java. I have a Ball class, and a Test ...
Anonimni Gost's user avatar
0 votes
3 answers
145 views

I have a class Notif (yes i know attributes shouldnt be public): class Notif { public int found; public String reply; public Notif(int i){ found = i; } ...
thesaferose _'s user avatar
-3 votes
2 answers
419 views

I have below code public class TokenBucketRateLimiter implements RateLimiter { // Maximum number of tokens that can be accumulated in the bucket. private final long threshold; // Time unit ...
curiousengineer's user avatar

15 30 50 per page
1
2 3 4 5
72