multithreading - How can you visually represent which threads lock on which objects in Java while debugging? -


using following textbook thread wait/notify example, there tool (eclipse plugin?) tracks which thread locks on which object while stepping through , debugging? tool visually displays connections in way ideal if possible.

public class threada {     public static void main(string[] args) {         threadb b = new threadb();         b.start();         synchronized (b) {                   try {                 system.out.println("waiting b complete...");                 b.wait();             } catch (interruptedexception e) {             }             system.out.println("total is: " + b.total);         }     } }  class threadb extends thread {     int total;     public void run() {         synchronized (this) {             (int = 0; < 100; i++) {                 system.out.println(i);                 total += i;             }             notify();         }     } } 

eclipse support already. there symbol in stack of debug window synchronized is. if enable "show monitors" can see object on locks. can set in options of debug view "java | show monitors".


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -