HADOOP-18487. Disable spotbugs warnings of currency issues

It's not a real issue, just risk of duplicate writing to the cache,
where that is considered acceptable.

Change-Id: I11ef64d2bd0a303e678e114fb38317194d1b50cd
This commit is contained in:
Steve Loughran 2023-03-08 15:53:17 +00:00
parent fc4a4e9a9a
commit def228225d
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0
2 changed files with 3 additions and 12 deletions

View File

@ -451,7 +451,7 @@
</Match>
<Match>
<Class name="org.apache.hadoop.ipc.impl.ShadedProtobufHelper" />
<Class name="org.apache.hadoop.ipc.internal.ShadedProtobufHelper" />
<Bug pattern="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION" />
</Match>
</FindBugsFilter>

View File

@ -83,12 +83,7 @@ public final class ShadedProtobufHelper {
ByteString value = FIXED_BYTESTRING_CACHE.get(key);
if (value == null) {
value = ByteString.copyFromUtf8(key.toString());
final Text key1 = new Text(key.copyBytes());
synchronized (FIXED_BYTESTRING_CACHE) {
if (FIXED_BYTESTRING_CACHE.get(key1) == null) {
FIXED_BYTESTRING_CACHE.put(key1, value);
}
}
FIXED_BYTESTRING_CACHE.put(new Text(key.copyBytes()), value);
}
return value;
}
@ -102,11 +97,7 @@ public final class ShadedProtobufHelper {
ByteString value = FIXED_BYTESTRING_CACHE.get(key);
if (value == null) {
value = ByteString.copyFromUtf8(key);
synchronized (FIXED_BYTESTRING_CACHE) {
if (FIXED_BYTESTRING_CACHE.get(key) == null) {
FIXED_BYTESTRING_CACHE.put(key, value);
}
}
FIXED_BYTESTRING_CACHE.put(key, value);
}
return value;
}