Skip to content

Commit cf2cf33

Browse files
committed
fix other ut
Change-Id: Ib1441354aba3c45b09a72881692812a1f267b2af
1 parent 7d5691c commit cf2cf33

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowPartialIntegrationTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.ArrayList;
1919
import java.util.Arrays;
2020
import java.util.Collections;
21+
import java.util.concurrent.CountDownLatch;
2122

2223
import org.junit.After;
2324
import org.junit.Before;
@@ -78,18 +79,15 @@ public void testThreadGrade() throws InterruptedException, BlockException {
7879
flowRule.setCount(1);
7980
FlowRuleManager.loadRules(Arrays.asList(flowRule));
8081

81-
final Object sequence = new Object();
82+
final CountDownLatch latch = new CountDownLatch(1);
8283

8384
Runnable runnable = new Runnable() {
8485
@Override
8586
public void run() {
8687
Entry e = null;
8788
try {
8889
e = SphU.entry("testThreadGrade");
89-
synchronized (sequence) {
90-
System.out.println("notify up");
91-
sequence.notify();
92-
}
90+
latch.countDown();
9391
Thread.sleep(100);
9492
} catch (BlockException e1) {
9593
fail("Should had failed");
@@ -103,11 +101,7 @@ public void run() {
103101
Thread thread = new Thread(runnable);
104102
thread.start();
105103

106-
synchronized (sequence) {
107-
System.out.println("sleep");
108-
sequence.wait();
109-
System.out.println("wake up");
110-
}
104+
latch.await();
111105

112106
SphU.entry("testThreadGrade");
113107
System.out.println("done");

0 commit comments

Comments
 (0)