Naireen commented on code in PR #33408:
URL: https://github.com/apache/beam/pull/33408#discussion_r1920584519
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaMetrics.java:
##########
@@ -86,13 +100,26 @@ public void updateSuccessfulRpcMetrics(String topic,
Duration elapsedTime) {
if (latencies == null) {
latencies = new ConcurrentLinkedQueue<Duration>();
latencies.add(elapsedTime);
- perTopicRpcLatencies().put(topic, latencies);
+ perTopicRpcLatencies().putIfAbsent(topic, latencies);
Review Comment:
It won't accept
`perTopicRpcLatencies().computeIfAbsent(topic,
ConcurrentLinkedQueue::new).add(elapsedTime);`
saying that it's unable to infer the type of the argument. I tried a couple
of different variations, and couldn't get it to work with a lambda. It think
the issue is that it takes in a string, and we want a `ConcurrentQueue` of
`Duration `
This is what the compiler wants, and I don't know how to pass in a lambda
matching that signature
`String,Function<? super String,? extends ConcurrentLinkedQueue<Duration>>`
(my java knowledge is a limited.)
--
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]