The first question is here: this is a very short but fundamental thing in Java that I don't know about ...
In the following case, did the run() method somehow execute with the lock that somemethod() actually acquired?
public synchronized void somemethod() { Thread t = new Thread( new Runnable() { void run() { ... <-- is a lock held here ? } } t.start(); ... (lengthy stuff performed here, keeping the lock held) ... }
java multithreading synchronization locking
cocotwo
source share