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

Difference between wait() and sleep()

What is the difference between a wait() and sleep() in Threads? Is my understanding that a wait()-ing Thread is …

java multithreading sleep java-threads
"implements Runnable" vs "extends Thread" in Java

From what time I've spent with threads in Java, I've found these two ways to write threads: With implements Runnable: …

java multithreading runnable implements java-threads
How to use wait and notify in Java without IllegalMonitorStateException?

I have 2 matrices and I need to multiply them and then print the results of each cell. As soon as …

java multithreading exception java-threads
Difference between Service, Async Task & Thread?

What is the difference between Service, Async Task & Thread. If i am not wrong all of them are used …

android android-asynctask android-service java-threads
If i synchronized two methods on the same class, can they run simultaneously?

If i synchronized two methods on the same class, can they run simultaneously on the same object? for example: class …

java multithreading synchronized java-threads
Why Thread.sleep is bad to use

Apologies for this repeated question but I haven't found any satisfactory answers yet. Most of the question had their own …

java multithreading java-threads
Turning an ExecutorService to daemon in Java

I am using an ExecutoreService in Java 1.6, started simply by ExecutorService pool = Executors.newFixedThreadPool(THREADS). When my main thread is …

java multithreading threadpool executorservice java-threads
How can I run thread from Main method in Java application?

I believe variables used in static main method should be also static as well. The problem is that I cannot …

java multithreading java-threads
what is RMI TCP connection

I'm making a desktop application in java and am doing some memory optimisations. That made me come across two threads …

java memory optimization heap java-threads
How to notify a specific thread in Java

How I can call a particular thread in inter-thread communication? In the program below I have two threads t1 and …

java multithreading ipc java-threads