tolbertam commented on code in PR #2060:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2060#discussion_r2490946129


##########
core/src/main/java/com/datastax/oss/driver/api/core/tracker/RequestIdGenerator.java:
##########
@@ -67,11 +67,27 @@ default String getCustomPayloadKey() {
 
   default Statement<?> getDecoratedStatement(
       @NonNull Statement<?> statement, @NonNull String requestId) {
-    Map<String, ByteBuffer> customPayload =
-        NullAllowingImmutableMap.<String, ByteBuffer>builder()
-            .putAll(statement.getCustomPayload())
-            .put(getCustomPayloadKey(), 
ByteBuffer.wrap(requestId.getBytes(StandardCharsets.UTF_8)))
-            .build();
-    return statement.setCustomPayload(customPayload);
+
+    // local copy
+    Map<String, ByteBuffer> existing = statement.getCustomPayload();
+    String key = getCustomPayloadKey();
+
+    NullAllowingImmutableMap.Builder<String, ByteBuffer> builder =

Review Comment:
   Just wondering, at this point what value is `NullAllowingImmutableMap` 
providing?
   
   Since it is what has the duplicate key restriction, and it's main value is 
allowing null keys and values, but we would never set a null key/value in this 
context (correct me if I'm wrong?).
   
   As far as I understand it, it's just `ImmutableMap` that has the null 
key/value restriction.  Why wouldn't we just use a regular Map implementation 
and wrap it in `Collections.unmodifiableMap`?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to