死锁问题
问题
Dead lock in our App under some condition. Both database and application lock contributes to issue.
The issue could be simplified to following model.
Thread 1: Acquired DB Lock------------------||---------Try to get Application lock
Thread 2: Acquire Application lock------------||-----------Try to get DB locK
The things I want to highlight is that when we implement functions in multi-thread ENV.
we should not only pay attention to the lock explicitly invoked in our code but also the External Lock, eg: DML lock in this case.
解决
将get DB lock代码放在Application lock范围之中