问题
ThreadA invoke ThreadB, and then update DB
ThreadB read DB, expect the update DB is finished by ThreadA
But in some condition, Thread A update DB is slow, ThreadB have finished and update DB is not started.
解决
Use ReentrantLock
问题
ThreadA invoke ThreadB, and then update DB
ThreadB read DB, expect the update DB is finished by ThreadA
But in some condition, Thread A update DB is slow, ThreadB have finished and update DB is not started.
解决
Use ReentrantLock