Hello Li zhai,
the "GUI" just wait......for ever until "A" release the lock. Is this design ok?
Prabably you are thinking that this could be easily solved starting a new
Thread of execution and delegating the lock method processing to that thread.
But be aware, neglecting the
event dispatch thread can arise several problems (batch updates, unsynchronized repainting,...).
My decission is comment the problem, and the solution in a real environment.
You can look at
SwingWorker for more information.
Regards