This is an automated email from the ASF dual-hosted git repository.

gwphua pushed a commit to branch jsonmapper-reader-optimization
in repository https://gitbox.apache.org/repos/asf/druid.git

commit 3f4e901d037d83163d0deec5e3f167622c62290b
Author: GWphua <[email protected]>
AuthorDate: Fri Aug 29 18:28:32 2025 +0800

    Optimize ObjectMapper reading in ChangeRequestHttpSyncer
---
 .../apache/druid/server/coordination/ChangeRequestHttpSyncer.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java
 
b/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java
index 6db1eac5d5d..f996ff14c19 100644
--- 
a/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java
+++ 
b/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncer.java
@@ -20,6 +20,7 @@
 package org.apache.druid.server.coordination;
 
 import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JavaType;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.jaxrs.smile.SmileMediaTypes;
 import com.google.common.annotations.VisibleForTesting;
@@ -65,11 +66,11 @@ public class ChangeRequestHttpSyncer<T>
   private static final long MAX_RETRY_BACKOFF = TimeUnit.MINUTES.toMillis(2);
 
   private final ObjectMapper smileMapper;
+  private final JavaType changeRequestsSnapshotResponseType;
   private final HttpClient httpClient;
   private final ScheduledExecutorService executor;
   private final URL baseServerURL;
   private final String baseRequestPath;
-  private final TypeReference<ChangeRequestsSnapshot<T>> 
responseTypeReferences;
   private final long serverTimeoutMS;
   private final long serverHttpTimeout;
 
@@ -116,11 +117,11 @@ public class ChangeRequestHttpSyncer<T>
   )
   {
     this.smileMapper = smileMapper;
+    this.changeRequestsSnapshotResponseType = 
smileMapper.getTypeFactory().constructType(responseTypeReferences);
     this.httpClient = httpClient;
     this.executor = executor;
     this.baseServerURL = baseServerURL;
     this.baseRequestPath = baseRequestPath;
-    this.responseTypeReferences = responseTypeReferences;
     this.serverTimeoutMS = serverTimeoutMS;
     this.serverHttpTimeout = serverTimeoutMS + HTTP_TIMEOUT_EXTRA_MS;
     this.listener = listener;
@@ -279,7 +280,7 @@ public class ChangeRequestHttpSyncer<T>
                   }
 
                   log.debug("Received sync response from server[%s]", 
logIdentity);
-                  ChangeRequestsSnapshot<T> changes = 
smileMapper.readValue(stream, responseTypeReferences);
+                  ChangeRequestsSnapshot<T> changes = 
smileMapper.readValue(stream, changeRequestsSnapshotResponseType);
                   log.debug("Finished reading sync response from server[%s]", 
logIdentity);
 
                   if (changes.isResetCounter()) {


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

Reply via email to