different tags could be written to the same file
There was a missing synchronization in the code that maps Strings to Integers.
This commit is contained in:
@@ -121,8 +121,12 @@ public class UniqueStringIntegerPairs {
|
||||
public Integer computeIfAbsent(final String first, final Function<String, Integer> mappingFunction) {
|
||||
|
||||
if (!stringToInt.containsKey(first)) {
|
||||
final Integer second = mappingFunction.apply(first);
|
||||
put(first, second);
|
||||
synchronized (stringToInt) {
|
||||
if (!stringToInt.containsKey(first)) {
|
||||
final Integer second = mappingFunction.apply(first);
|
||||
put(first, second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stringToInt.get(first);
|
||||
|
||||
Reference in New Issue
Block a user