Skip to content
Commit 5ecea7cd authored by Jimmy Shiu's avatar Jimmy Shiu
Browse files

Fixed flaky HintManagerServiceTest#testReportActualWorkDuration

The flake is related to the running sequence. If Object#notify() is called before Object#wait(), the latter will block forever.

Using CountDownLatch to solve the problem.
CountDownLatch#await() will wait until its count reaches 0.
CountDownLatch with an initial count of 1, so the code after CountDownLatch#await() will only run after CountDownLatch#countDown() has been called.

Bug: 277881247
Test: atest HintManagerServiceTest
Test: verify by adding sleep between countdown() and await()
Change-Id: I1a2b0fbec5f48f504107e3c031bf6e9f3ff571f5
parent a067b1c0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment