You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gw...@apache.org on 2025/08/29 10:34:00 UTC

(druid) branch jsonmapper-reader-optimization created (now 3f4e901d037)

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

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


      at 3f4e901d037 Optimize ObjectMapper reading in ChangeRequestHttpSyncer

This branch includes the following new commits:

     new 3f4e901d037 Optimize ObjectMapper reading in ChangeRequestHttpSyncer

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


(druid) 01/01: Optimize ObjectMapper reading in ChangeRequestHttpSyncer

Posted by gw...@apache.org.
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 <ph...@gmail.com>
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: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org