Top "Java-threads" questions

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

DestroyJavaVM thread ALWAYS running

When profiling my application I came across a weird behavior - the DestroyJavaVM thread is ALWAYS running - 100% of the …

java multithreading jvm java-threads
Java thread state transition, WAITING to BLOCKED, or RUNNABLE?

There seems to be a discrepancy between SO consensus and nearly every Java thread state diagram on the Internet; specifically, …

java multithreading thread-state java-threads
Do multiple threads Using the same object in java make a copy of it?

How do multiple threads in Java handle working with a single object reference passed to them? Do they make a …

java multithreading thread-safety thread-synchronization java-threads
synchronized object not locked by thread before notifyAll()

I want to have a boolean to notify some sections of the system that a specific service started. For some …

java multithreading synchronization synchronized java-threads
how to stop a thread with thread interrupt method

I am trying to learn thread interrupt and how to make a thread terminate without calling stop. public class Test …

java multithreading concurrency java-threads interruption
How to access running threads inside ThreadPoolExecutor?

I have a queue of running threads and would like to expose some of its data while it is executed, …

java multithreading threadpoolexecutor java-threads
ExecutorService's shutdown() doesn't wait until all threads will be finished

I have a code where 4 threads run at the same time. I want to wait until all these 4 threads will …

java multithreading concurrency executorservice java-threads
onSpinWait​() method of Thread class - Java 9

While learning Java 9 features I came across a new method of Thread class, called onSpinWait​. As per javadocs, this method …

java multithreading concurrency java-threads spinlock
Tomcat memory leak issue of log4j2 thread

I'm using log4j2 for logging, tomcat8 and java8 version. I used attribute "monitorInterval" to periodically check my log4j2.…

java log4j2 tomcat8 java-threads