ci: rid test sync
This commit is contained in:
parent
ba9378fa29
commit
b53cbda642
|
@ -31,8 +31,10 @@ public class RIdGeneratorTests {
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
long nextId = NumGenerator.nextNum(projectId, ApplicationNumScope.API_DEFINITION);
|
long nextId = NumGenerator.nextNum(projectId, ApplicationNumScope.API_DEFINITION);
|
||||||
System.out.println(nextId);
|
System.out.println(nextId);
|
||||||
if (atomicLong.get() < nextId) {
|
synchronized (projectId) {
|
||||||
atomicLong.set(nextId);
|
if (atomicLong.get() < nextId) {
|
||||||
|
atomicLong.set(nextId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,10 @@ public class RIdGeneratorTests {
|
||||||
// 接口用例的前缀为: PROJECT_ID_API_DEFINITION 比较特殊
|
// 接口用例的前缀为: PROJECT_ID_API_DEFINITION 比较特殊
|
||||||
long nextId = NumGenerator.nextNum(projectId + "_" + apiNum, ApplicationNumScope.API_TEST_CASE);
|
long nextId = NumGenerator.nextNum(projectId + "_" + apiNum, ApplicationNumScope.API_TEST_CASE);
|
||||||
System.out.println(nextId);
|
System.out.println(nextId);
|
||||||
if (atomicLong.get() < nextId) {
|
synchronized (projectId) {
|
||||||
atomicLong.set(nextId);
|
if (atomicLong.get() < nextId) {
|
||||||
|
atomicLong.set(nextId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue