Is there a timeout for threads waiting for a synchronized method in Java?

Is there a default timeout for threads waiting for a synchronized method in Java? Some threads in my application do not terminate as expected. Is there anyway to check if threads died as a result of timeouts?

+3
source share
5 answers

JLS does not specify a timeout for partitions synchronized. He just mentions

While the execution thread owns the lock, no other thread can get the lock.

+4
source

You can set a timeout in the join () method to make sure you are not waiting forever.

java.util.concurrent, , , .

"Java Concurrency In Practice". ( ).

+4

, , (, , "" ), - . , ?

0

Java . ( ), , , ( System.err).

, . JVM , .

Linux, kill -QUIT <pid> Windows, Ctrl + Break . , VisualVM, StackTrace .

0
source

I suggest you use kill -3 to see the dump of the thread, and then see what the problem threads are.

0
source

Source: https://habr.com/ru/post/1736890/


All Articles