For debugging purposes, I want to find out which threads of my program are still running. There seems to be one or more threads that were not accidentally interrupted. Some good print format would be a bonus.
jVisualVM is your friend for this kind of debugging. It is located in the / bin directory of your JDK installation. Shows all threads as a graphical representation and allows you to expand what they do. The button Thread Dumpprints all of its current stack traces so you can see that something is stuck somewhere in your user code.
Thread Dump
"jps", java- jstack .
jstack doc
, - ( JDK 1.5 ) :
Map<Thread, StackTraceElement[]> stack = Thread.getAllStackTraces(); for (Map.Entry<Thread, StackTraceElement[]> entry : stack.entrySet()) { System.out.println("Thread named '" + entry.getKey().getName() + "' is alive"); }
nogudnik tempus-fugit ( ), . http://tempusfugitlibrary.org/documentation/threading/dumps/
", , ". , . Thread.interrupt() runnable. , , (, Thread.sleep java.nio), InterruptedException - (, ClosedByInterruptException nio). runnables Thread.currentThread(). IsInterrupted() .
Source: https://habr.com/ru/post/1778860/More articles:How are callbacks performed in WCF? - .netARM Darwin assembly - search for system calls (possibly a tutorial) - assemblyCannot call user-defined JS function after returning AJAX content - javascriptConvert custom field image to become favorite in WordPress? - imageHow can an incorrect XML header (encoding) be changed on the fly in IIS before being processed by the WCF class? - xmlGetting "Unable to use undefined as ARRAY error" in my KRL code - krlHow to access models in PagesController - or how to create a dashboard using CakePHP - cakephpIn Django, how can I save the value of the File input after returning it through an error? - javascriptLinq to SQL VS Entity Framework - c #How can I track line creation in Ruby? - ruby | fooobar.comAll Articles