p-kimberley commented on code in PR #7603:
URL: https://github.com/apache/nifi/pull/7603#discussion_r1294515672
##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeduplicateRecord.java:
##########
@@ -625,40 +609,17 @@ public
DistributedMapCacheClientWrapper(DistributedMapCacheClient client) {
@Override
public boolean contains(String value) {
try {
- return client.containsKey(value, STRING_SERIALIZER);
+ return !client.putIfAbsent(value, "", STRING_SERIALIZER,
STRING_SERIALIZER);
} catch (IOException e) {
throw new ProcessException("Distributed Map lookup failed", e);
}
}
@Override
public void put(String value) {
- /*
- * This needs to be a noop because this process will be used
upstream of the systems that would write the records
- * that power the map cache.
- */
+ // Do nothing as the key is queried and put to the cache
atomically in the `contains` method.
}
}
private static final Serializer<String> STRING_SERIALIZER = (value,
output) -> output.write(value.getBytes(StandardCharsets.UTF_8));
- private static final Serializer<Boolean> BOOLEAN_SERIALIZER = (value,
output) -> output.write((byte) (value ? 1 : 0));
Review Comment:
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]