Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDR-16158 synchronize CheckCLDR in TestCache #3772

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ protected TestResultBundle(CheckCLDR.Options cldrOptions) {
options = cldrOptions;
pathCache = new ConcurrentHashMap<>();
file = getFactory().make(options.getLocale().getBaseName(), true);
cc.setCldrFileToCheck(file, options, possibleProblems);
synchronized (cc) {
cc.setCldrFileToCheck(file, options, possibleProblems);
}
}

/**
Expand All @@ -68,12 +70,14 @@ public void check(String path, List<CheckStatus> result, String value) {
key,
(Pair<String, String> k) -> {
List<CheckStatus> l = new ArrayList<CheckStatus>();
cc.check(
k.getFirst(),
file.getFullXPath(k.getFirst()),
k.getSecond(),
options,
l);
synchronized (cc) {
cc.check(
k.getFirst(),
file.getFullXPath(k.getFirst()),
k.getSecond(),
options,
l);
}
return l;
});
if (cachedResult != null) {
Expand All @@ -82,7 +86,9 @@ public void check(String path, List<CheckStatus> result, String value) {
}

public void getExamples(String path, String value, List<CheckStatus> result) {
cc.getExamples(path, file.getFullXPath(path), value, options, result);
synchronized (cc) {
cc.getExamples(path, file.getFullXPath(path), value, options, result);
}
}

public List<CheckStatus> getPossibleProblems() {
Expand Down
Loading