Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [java-threads]

For questions related to Java threads, including concurrent data structures, the fork-join framework, atomic classes, thread locking/synchronization, visibility and latency

java-threads
-1 votes
0 answers
36 views

Cyclicbarrier implementation in Java, can it be used as a latch too

Here is my implementation of CyclicBarrier public class CyclicBarrier { int numParties, arrived; Semaphore mutex; Semaphore barrier1, barrier2; public CyclicBarrier(int parties) { ...
curiousengineer's user avatar
0 votes
1 answer
53 views

What problems can I have with spawning a set of new threads from Servlet and what alternatives exist?

For simplicity, I will omit some details and try to highlight the main point: I have a servlet that consumes users' requests, when a user sends a request I need to gather data from many endpoints. One ...
Pavel Petrashov's user avatar
1 vote
0 answers
46 views

How to catch any exceptions that occurs in a Future that is being interrupted in Java?

I am trying to implement a timeout on a save operation on a PDF document. I have this piece of code so far: private Boolean saveDocumentWithTimeout(Path path, PDDocument pdDocument) { ...
Tmfwang's user avatar
  • 650
1 vote
0 answers
44 views

Facing issue in threading [closed]

I am calling threads based on records selected from database. However, I am seeing that same records are initiated multiple times in the thread. Also I am inserting records in the keyvaluepairs inside ...
Abhishek sharma's user avatar
0 votes
0 answers
50 views

Can't stop java application wrapped as windows service using procrun

I am trying to wrap a java application as a windows service. I use procrun to do so and it works fairly good (I can install the service and start it, the application works fine), but when I try to ...
Juan E. Ordóñez's user avatar
1 vote
1 answer
85 views

Confusion about thread synchronization

public class Interview implements Runnable { int b = 100; public synchronized void m1() throws Exception { //System.out.println("-----"); b = 1000; Thread....
苏苏沐哲's user avatar
0 votes
1 answer
48 views

why grpc java thread is blocked without any lock or synchronization syntax around the blocked line

At application startup, I've noticed an extreme delay in the initialization of my gRPC client stream. Through thorough examination via logs and jstack, I've identified that the 'grpc-default-executor-{...
Andrew ren's user avatar
0 votes
0 answers
15 views

Adding pararelism to algorithm wator in java

I have a school project where they make me optimize alogrithms. The task is to add paralerism to the algorithm. I choose wator and I have to run using static decomposition of the matrix of cells with ...
Dave's user avatar
  • 1
1 vote
1 answer
34 views

How can I identify which code in my Android application initiates the creation of threads using the Android Profiler

I am working on a plugin-based application which has different plugins. Each plugin is independent of the others. I am also using the Google Places API as a plugin in it. There is an option to refresh ...
Aditya Mishra's user avatar
0 votes
0 answers
63 views

Exception in Execute Select java.lang.IllegalThreadStateException: Thread is already started

Getting Excpetion in Execute Select java.lang.IllegalThreadStateException: Thread is already started when we are trying to execute a select statement in a sql server through java below is the code ...
Bharath Mocherla's user avatar
2 votes
1 answer
211 views

Spring @Async architecture for scheduled, long running api calls

I need to solve the following problem, described exemplary: My Spring application checks every minute if there is a new job. If there is a job, it subtasks should be run in parallel. They are mostly ...
Maltram's user avatar
  • 49
-1 votes
1 answer
131 views

Function for making the code wait in javafx

Im new to using javaFx and programming in general so this might be a stupid question. Im trying to make a function that makes the thread wait without crashing the program which would result in ...
idk's user avatar
  • 3
0 votes
0 answers
41 views

How does the class Exchanger in Java actually work?

I'm still very new to how Threads work in Java and I got an assignment to recreate the Exchanger class based on its functionality. I read the documentation and I understand what it is supposed to do, ...
ARainyCloud's user avatar
0 votes
1 answer
25 views

JMeter threads hang in sockets and do not restart

I'm running JMeter tests. However, after some time, I encounter several errors: Non HTTP response code: java.net.SocketTimeoutException And after that, the threads do not restart, although it says ...
Vitya Madara's user avatar
1 vote
0 answers
37 views

Can anything external to the JVM interrupt Process.waitFor()?

I've been using roughly the same utility code to handle executing an external Process for at least a decade. Recently a customer hit a case where the following ~code was interrupted: try { int ...
Bobby's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
72